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
 Saving to jpeg issue

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
cpstevenc Posted - Jul 27 2011 : 13:35:48
Using ImageEn 3.1.2

I have a problem where i read in an image, scale it, and export it out.

Code is like below...

Image := tImageEn.create(nil);
image.IO.LoadFromFile(fn);
w:=image.Bitmap.Width;
if (w>800) then image.proc.Resample(800,-1,rfnearest);
Image.io.Params.JPEG_Quality:=75;
image.IO.SaveToFileJpeg(outputFN);


Sometimes the output file "works" as in other apps can view it, but imageEN can not. ImageEN wont error out loading it, but it wont show anything either. And sometimes it just makes 0 byte files when saving.
4   L A T E S T    R E P L I E S    (Newest First)
cpstevenc Posted - Aug 22 2011 : 15:10:04
Thanks so much! I found others with same thing.. JPG extension.. and GIF header..

Ended up being i was saving images to JPGs... but those were the scaled down versions. The "original" image was getting copied over to a new location and renamed.. and the extension was jpg.

Located and fixed it on my side.. thanks!

< i feel so dumb >
fab Posted - Aug 22 2011 : 13:22:02
The file you have sent me is a PNG with ".jpg" extension. This can happen if you execute, for example:

Image.IO.SaveToFilePNG('1234.jpg'); // <- wrong extension!!

If you then reload the image using:

Image.IO.LoadFromFile('1234.jpg');

....it, of course, fails.

In fact you could load it using:

Image.IO.LoadFromFileAuto('1234.jpg');

...or open it with an hex editor to see the header (it is actually a PNG not a Jpeg).

Please check the code that actually generated the jpeg.
cpstevenc Posted - Aug 22 2011 : 13:05:55
Sent
fab Posted - Jul 27 2011 : 13:57:07
I cannot replicate this problem.
Please could you provide more details (i.e. an input image that produces this problem or a full project which replicate it)?