Reducing the file size of a very large images, wit

2019-03-08 19:22发布

Consider an application handling uploading of potentially very large PNG files.

All uploaded files must be stored to disk for later retrieval. However, the PNG files can be up to 30 MB in size, but disk storage limitations gives a maximum per file size of 1 MB.

The problem is to take an input PNG of file size up to 30 MB and produce an output PNG of file size below 1 MB.

This operation will obviously be lossy - and reduction in image quality, colors, etc is not a problem. However, one thing that must not be changed is the image dimension. Hence, an input file of dimension 800x600 must produce an output file of dimension 800x600.

The above requirements outlined above are strict and cannot be changed.

Using ImageMagick (or some other open source tool) how would you go about reducing the file size of input PNG-files of size ~30 MB to a maximum of 1 MB per file, without changing image dimensions?

12条回答
等我变得足够好
2楼-- · 2019-03-08 19:26

I know you want to preserve the pixel size, but can you reduce the pixel size and adjust the DPI stored with the image so that the display size is preserved? It depends on what client you'll be using to view the images, but most should observe it. If you are using the images on the web, then you can just set the pixel size of the <img> tag.

查看更多
放我归山
3楼-- · 2019-03-08 19:29

If you want to modify the image size in ubuntu, you can try "gimp". I have tried couple of image editing apps in ubuntu and this seemed to be the best among them.

HOW TO INSTALL?

-Open terminal

-type: sudo apt-get install gimp-plugin-registry

-give admin password. you need net connection for this.

-Once installed, open the image with GIMP image editor. Then goto: File > Export as > Click on 'Export' button

-You will get a small window, where check box on "Show preview in image window". Once you check this option, you will get to see the current size of the file along with Quality level.

-Adjust the quality level to increase/decrease the file size.

-Once adjusting is done, click on 'Export' button finally to save the file.

查看更多
干净又极端
4楼-- · 2019-03-08 19:31

Try ImageOptim https://imageoptim.com/mac it is free and open source

查看更多
相关推荐>>
5楼-- · 2019-03-08 19:32
  • Step 1: Decrease the image to 1/16 of its original size.
  • Step 2: Decrease the amount of colors.
  • Step 3: Increase the size of the image back to its original size.
查看更多
可以哭但决不认输i
6楼-- · 2019-03-08 19:34

Right click on the image. Select open with paint. Click on resize. Click on pixel and change the horizontal to 250 or 200.

That's the only thing. It is the fastest way for those who are using Windows XP or Windows 7.

查看更多
在下西门庆
7楼-- · 2019-03-08 19:35

Since the size of an image file is directly related to the image dimensions and the number of colours, you seem to have only one choice: reduce the number of colours.

And ~30MB down to 1MB is a very large reduction.

It would be difficult to achieve this ratio with a conversion to monochrome.

查看更多
登录 后发表回答