ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 percent color of all channel

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
MMP112 Posted - Aug 24 2016 : 09:49:17
we have a psd file with 5 channel color contain the
1.blue
2.pink
3.yellow
4.brown
5.gold

i need to calculated the percent used of the channels color in the files seem average in photoshop.
please help me
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 01 2016 : 21:24:11
Here are some examples of working with TIEBitmap.Scanline:

// Convert image to gray-scale (PixelFormat must be ie24RGB)
// Same as TImageEnProc.ConvertToGray
var
  x, y: Integer;
  pPix: PRGB;
  Gray: Byte;
begin
  for y := 0 to ImageEnView1.IEBitmap.Height - 1 do
  begin
    pPix := ImageEnView1.IEBitmap.ScanLine[ y ];
    for x := 0 to ImageEnView1.SelectionMask.Width - 1 do
    begin
      Gray := (pPix^.R * IEGlobalSettings().RedToGrayCoef + pPix^.G * IEGlobalSettings().GreenToGrayCoef + pPix^.B * IEGlobalSettings().BlueToGrayCoef) div 100;
      pPix^.R := Gray;
      pPix^.G := Gray;
      pPix^.B := Gray;

      inc( pPix );
    end;
  end;
  ImageEnView1.Update();
end;


// Set all pixels within selection as red
// Same as ImageEnView1.SetSelectedPixelsColor
var
  x, y: Integer;
  pSel: pbyte;
  pPix: PRGB;
begin
  if ImageEnView1.SelectionMask.IsEmpty then
    raise Exception.create( 'Nothing selected' );

  if ImageEnView1.IEBitmap.PixelFormat <> ie24RGB then
    raise Exception.create( 'Not 24bit' );

  // Process selected area
  for y := 0 to ImageEnView1.SelectionMask.Height - 1 do
  begin
    pSel := ImageEnView1.SelectionMask.ScanLine[ y ];
    pPix := ImageEnView1.IEBitmap.ScanLine[ y ];

    case ImageEnView1.SelectionMask.BitsPerPixel of
      1:
        for x := 0 to ImageEnView1.SelectionMask.Width - 1 do
        begin
          // 1 Bit mask (values are 0 or 1)
          if (pbytearray(pSel)^[x shr 3] and iebitmask1[x and $7]) <> 0 then
          begin
            pPix^.R := 255;
            pPix^.G := 0;
            pPix^.B := 0;
          end;
          inc( pPix );
        end;
      8:
        for x := 0 to ImageEnView1.SelectionMask.Width - 1 do
        begin
          // 8 Bit mask (values are 0 to 255)
          if pSel^ <> 0 then
          begin
            pPix^.R := 255;
            pPix^.G := 0;
            pPix^.B := 0;
          end;
          inc( pSel );
          inc( pPix );
        end;
    end;
  end;
  ImageEnView1.Update();
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
MMP112 Posted - Aug 31 2016 : 04:09:39
hi
me use ImageEn 5.2 for delphi 7
xequte Posted - Aug 26 2016 : 21:02:46
Hi

What version of ImageEn are you using?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
MMP112 Posted - Aug 26 2016 : 05:17:57
hi
thanks for the reply my problem .
me try to use scanlines for solve problems but i dont know how use this parameters for get color information.
please send to me a sample for solves problem.
thanks.
xequte Posted - Aug 24 2016 : 16:45:42
Hi

Fastest would probably be to iterate through all the scanlines of the bitmap, incrementing the values of each of the relevant color variables.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com