Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
nevodavid  
#1 Posted : Wednesday, November 5, 2014 10:16:48 PM(UTC)
nevodavid

Rank: Newbie

Groups: Member
Joined: 11/5/2014(UTC)
Posts: 1

Hi, is there any way to resize picture in MB?
for example: if someone uploaded 10MB file i want it to be 2MB,
I want the resize to be in MB and not in pixels.

hope it makes sense,
Thanks, Nevo.
Andrew  
#2 Posted : Thursday, November 6, 2014 6:47:48 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 868

Thanks: 2 times
Was thanked: 26 time(s) in 26 post(s)
Hi Nevo,

Unfortunately the uploader does not allow this. I can imagine the algorithm which could pick the optimal width/height to receive the image of specified size (with fixed JpegQuality), however I am not sure if it is really necessary.

If you don't need the image to be exactly 2MB, but just need it to be approximately 2MB, you can precalculate the required dimensions.

When the JPEG quality is 80, the compression ratio is around 25 (see this blog post for details). The uncompressed version of 2MB JPEG with compression ratio 25 should occupy 50MB. Each pixel is 24-bit RGB, i.e. occupies 3 bytes, so 50MB is 12.5Mpix (i.e. ~3500x3500).

It won't always give you 2MB, but it will be something around that.

Hope this helps.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.