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
 JPEG Quality to one MB

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
HeiniPotsdam Posted - May 02 2018 : 10:37:20
I have several JPEG files.
I want to store them in a database.
The size of the files is very different, from 0,5 MB to 8 MB.

I want to store the files with around 1 MB.
Reducing the quality over IO.Params.JPEG_Quality.

I tried loading the files and reducing the quality step by step until 1MB is reached. A slow way.

Anybody know a better way?

Best regards, Olaf
2   L A T E S T    R E P L I E S    (Newest First)
HeiniPotsdam Posted - May 03 2018 : 17:45:11
Hi Nigel

Thank you

I've tried different file sizes now.
From this I have calculated an approximate straight line, but with a wide dispersion.
Now I get smaller files, which are often relatively close to 1 Mb.
That's enough for my purposes.

Best regards, Olaf
xequte Posted - May 03 2018 : 16:55:19
Hi Olaf

Arbitrary limits on JPEG image size are always problematic. Because of lossy compression, guessing the final size is like asking how much red paint will I need to paint a sunset

If you must have the limit, then ensure you use a memory stream rather than saving to temp files, and use a halving process to narrow in on the optimal size. e.g. measure 60% and 80%. Assuming 60% is <1MB and 80% >1MB, then try 70%. Too small? Try 75%, etc.



Nigel
Xequte Software
www.imageen.com