There are some Jpg images which Delphi doesn't seem to like. It appears to be specific with the files I'm loading. And the procedure is simple - a) load Jpg image to TJpegImage
, b) Assign Jpg object to a TBitmap
object, and c) Save and/or display Bmp image. For some reason, these pictures keep coming out with a blueish tint.
These images show perfectly anywhere and everywhere else I load them (windows picture viewer, paint, photoshop, etc.).
And what I'm doing is very simple...
procedure Load;
var
J: TJpegImage;
B: TBitmap;
begin
J:= TJpegImage.Create;
B:= TBitmap.Create;
J.LoadFromFile('C:\SomeFile.jpg');
B.Assign(J);
//Either save or display `B` and it appears blueish at this point
....
I want to avoid getting any third party stuff as much as possible. This problem has existed in Delphi versions 7, 2010, and XE2. At least the TImage control in XE2 displays it properly (as opposed to the older two) but that doesn't matter if the TBitmap still doesn't work. What is wrong with this file? And/or, what is wrong with Delphi's rendering?
Added Info
I recently found out something about these images. When they came from the vendors (product pictures), they were in CMYK format. At that time, Delphi 7 didn't properly support these files (with access violations and bad images) so all the pictures were filtered through a converter to RGB color format. Many original images were also TIFF and were converted to JPG. So it appears that the software FastStone Image Resizer
must not properly save these files when they go through. The blue image doesn't happen on all of them, just some random batches at a time. The software handles thousands of products, so there are thousands of possible pictures.
NativeJpg v.1.30
– Rayfor /f %f in (*.jpg) do @convert %f %~nf.bmp
– LavonnaTsdJpegGraphic
works like butter. – UdoFastStone Image Resizer
for this one. – UdoTPicture
much sooner... – Udo