Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
'Night folks!
I'm making a web app where users will upload pictures, but my disk is limited.
I need to make those images lighter in bytes.
Perhaps that will hurt resolution, but I don't care :p

Do you have a link, or can you provide a hint to the answer on...
How to lower image file size?

Thank you so much for your help!
Posted
Comments
Sergey Alexandrovich Kryukov 3-Nov-13 20:09pm    
I hope you always compress images, use JPEG or PNG, don't you?
—SA

1 solution

You understand it all correctly, it may hurt resolution, or worse, quality of images. What can I advise? Announce that, effective immediately, uploading of images is no longer allowed. Perhaps it will hurt attractiveness of your site, but I don't care. :-)

—SA
 
Share this answer
 
Comments
Homero Rivera 3-Nov-13 20:36pm    
Smart answer! But is not quite business-wise. If you're planning to make a website with outsourced hosting and they charge you so much per month per GB, and the images can cost a lot of disk space, and they are not supposed to be screeenwide... Then lowering the image file size when it is above 2 MB might be a necessary move. So I don't care about this answer either! :p But thanks for this valuable insight, Comrade Kryukov!
Sergey Alexandrovich Kryukov 3-Nov-13 20:46pm    
You are welcome.

If you don't like this one, here is another version of it: there is no such thing as miracle. You need to use proper compression, you need to provide sufficient volume for some reasonable image size and quality. Here is the thing: if you don't care of the quality of the images, what you are care of, about your site?

Business-wise? A business view on this situation is very, very simple: your users will look at it and question: if you don't allow enough image size to render our excellent photos, why are we using this service? And they will stop using it. And you can keep saving your money on hosting as much as you can. That's all.

After all, some limitation of the file size might be of course reasonable, but then, what's the problem? You can always re-sample the images if they are too big, or deny up-loading when the file is too big, and re-pack the file if user's compression is far from optimal. Which part if it can be a problem for you?

—SA
Homero Rivera 3-Nov-13 20:55pm    
You know, you're probably right! My mind's all burned-out given so much work that I might not be looking at the big picture (but you wouldn't care right? lol).

In case someone is interested, there is some theoretical basis on the problem: look at the JPEG specification, parse the file as byte[], work your bytes out within the specification, then parse the bytes to a new JPEG file. But this is theoretical.

I'll be looking for lower hosting costs.

Thanks Comrade
Sergey Alexandrovich Kryukov 3-Nov-13 21:26pm    
You are welcome, товарищ.

And thank you for the good idea: now I understand that some don't try to look at the big picture because they might thing it would take up too many bytes. :-)

For a record, all you need to make those steps for re-sampling the image is already programmed in .NET FCL, so this theoretical possibility give a quite practical solution. In particular, you can use System.Windows.Drawing.Bitmap. It can be especially helpful if most traffic is used on viewing, not uploading (very likely in most cases) especially if the total disk volume is one of the bottlenecks.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900