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
 wrong colors with b/w TIFF files

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
DRIGUS Posted - Feb 23 2018 : 10:38:36
Hi *.*.

in the past we use something like the code below in order to load and process different image files:


var
  ImageIO: tImageEnIO;
  Buffer: tBitmap;

begin
  Buffer := tBitmap.Create;
  ImageIO := tImageEnIO.CreateFromBitmap(Buffer);
  ImageIO.LoadFromFile(aFileName1);

  Buffer.SaveToFile(aFileName2);

  ImageIO.Free;
  Buffer.Free;
end;


This leads sometimes (but not in all cases) to wrong colors when loading b/w TIFF files, f.e. the background is red instead of white. I can observe this behavior with ImageEn 6.3.2, 7.0.1 and 7.5.0, but not with an older version (must be a 4.x version), using Delphi 5 (yes, 5!).

It works as expected if I change the code like this:


var
  ImageIO: tImageEnIO;
  Buffer: tBitmap;

begin
  ImageIO := tImageEnIO.Create(nil);
  ImageIO.LoadFromFile(aFileName1);

  Buffer := tBitmap.Create;
  ImageIO.IEBitmap.CopyToTBitmap(Buffer);
  Buffer.SaveToFile(aFileName2);

  ImageIO.Free;
  Buffer.Free;
end;



Greetings
2   L A T E S T    R E P L I E S    (Newest First)
DRIGUS Posted - Feb 26 2018 : 10:27:03
Hi.

Because we need a quick solution, I changed the code to use the internal TIEBitmap of TImageEnIO and call CopyToBitmap in order to get a TBitmap for further processing. This works as expected.

But if I remember right I tried something like


  Buffer := tBitmap.Create;
  Buffer.PixelFormat := pfDevice;
  Buffer.PixelFormat := pf1Bit;
  ImageIO := tImageEnIO.CreateFromBitmap(Buffer);
  ImageIO.LoadFromFile(aFileName1); 
  ... 


which seems to work, too.


Greetings.
xequte Posted - Feb 23 2018 : 19:56:07
Hi

In the first example, does it work correctly if you set the TBitmap.PixelFormat before attaching it to the TImageEnIO?

Also, where possible use TIEBitmap, rather than TBitmap, which overcomes many of its limitations.



Nigel
Xequte Software
www.imageen.com