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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Saving to jpeg issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

cpstevenc

USA
116 Posts

Posted - Jul 27 2011 :  13:35:48  Show Profile  Reply
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.

fab

1310 Posts

Posted - Jul 27 2011 :  13:57:07  Show Profile  Reply
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)?
Go to Top of Page

cpstevenc

USA
116 Posts

Posted - Aug 22 2011 :  13:05:55  Show Profile  Reply
Sent
Go to Top of Page

fab

1310 Posts

Posted - Aug 22 2011 :  13:22:02  Show Profile  Reply
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.
Go to Top of Page

cpstevenc

USA
116 Posts

Posted - Aug 22 2011 :  15:10:04  Show Profile  Reply
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 >
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: