LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to compress a .png image in Gimp? (https://www.linuxquestions.org/questions/linux-software-2/how-to-compress-a-png-image-in-gimp-295833/)

ganoo 02-28-2005 08:26 AM

How to compress a .png image in Gimp?
 
I've managed to take a .png screenshot image of my desktop and I'd like to send it to a website that displays desktop screenshots, but my image is 1,3 MB in size and the website accepts only images that are smaller than 300 KB. I've got Gimp installed and I can use it to view the image, but I cannot figure out how I could use Gimp to compress my screenshot image to make it smaller than 300 KB. I have zero experience in manipulating graphics, so any advice to help me get started would be very much appreciated.

Andrew Benton 02-28-2005 09:00 AM

Click Image> Scale Image and reduce the size of the image in pixels. Then save it as a jpeg. Click File> Save as> Select File Type and reduce the quality

KimVette 02-28-2005 10:10 AM

Keep in mind that jpeg uses (very) lossy compression (it throws out details the algorithm thinks is not important) whereas PNG uses lossless compression. If you want to retain high definition in your photographs stick with the PNG format. If detail is not all that important then by all means jpeg may be the right option for you.

BTW: screenshots look particularly bad when saved as jpeg (as does all line art) so you may want to save as either a dithered eight-bit PNG file or as a dithered GIF file. It will be limited to only 256 indexed colors but rather than throwing definition out, those algorithms will resample the colors, pick the best 256 (well, 254 plus black and white) and dither the coloring, while retaining the sharp lines of your screenshots.

As far as using compression with PNG in The Gimp, which is the question you asked, do the following (as of The Gimp 2.0.0):

Click File -> Save As
Select "PNG" in the Determine File Type
Enter your filename and click OK

Next you will see a "Save as PNG" dialog - in here you can set various options, including the compression level. I'd avoid interlacing as it increases the file type slightly, and since most people are on broadband now there is little benefit to interlacing raster images.

ganoo 02-28-2005 11:06 AM

Saving my screenshot in .jpg format reduced the size from 1.3 MB to 175 KB. Then I tried .png with indexed colors, choosing "Use web-optimized palette" in Gimp. This produced a 200 KB image but the colors don't look very good (at least on my screen). Then I tried indexed .png with the "Generate optimum palette" in Gimp and this produced a better-looking image, but the size is 484 KB (too big). The website in question accepts both .jpg and .png images, so I think I'll just upload the .jpg version of my screenshot. Many thanks! :)

NoStop 02-28-2005 12:48 PM

I found having to open up a large application like Gimp just to resize an image, took more time than I wanted to use when dealing with this kind of situation. I'm often needing to resize an image. Then I found out about the power of ImageMagick and wrote a little bash script so that at the command line I could simply type:

resizeimg <filename> to get a smaller image created.

If you're interested, you can find the script and instructions here:

http://www.w-3productions.com/cvcs/w...tip_quick.html

Cheers,
Rene

fhleung 09-26-2014 09:20 PM

the topic was: How to compress a .png image in Gimp?

what about do it in command line?
anyone knows if command can also do that?

John VV 09-27-2014 12:35 AM

you do not use "the Gimp" in the terminal
it needs to run as the GUI

so

for WHAT text ONLY graphics program or library do you want to use ?

the old program "pngCrush"
Imagemagic ?
Gmic ?
Cimg.h ?
the old DevIl ?
the even older XV ?
your own custom c program calling libpng

what ?

astrogeek 09-27-2014 12:39 AM

In case you did not notice, this is another necro post... but ImageMagick resize is still good advice.

fhleung 09-27-2014 03:09 AM

ImageMagick ?? It can re-size the image pixel?

what I'd like was compression = reduce memory (MByte size to KByte)



John VV Guru, I asked the wrong thing... if I got an animated .GIF image, can I also reduce its memory size by which tool?

ondoho 09-27-2014 07:50 AM

yes.

imagemagick (command line: convert, mogrify) can do just about anything.


ps: fully aware of thread age. but, why not...

fhleung 09-29-2014 11:45 PM

Code:

convert input.gif -quality 1 output.gif
the memory size of the output animated .GIF
no big difference...

fhleung 04-15-2015 03:06 AM

http://php.net/manual/en/book.imagick.php

alternatively, in case if not ImageMagick, you may try php script web version

or download http://www.imagemagick.org/download/...86-windows.zip

John VV 04-15-2015 07:33 PM

fhleung
you are aware that this thread was started in 2005
it is 10 years old


and that link is to the MICROSOFT!@!!!!!!!! build of IM Q16

why the bleep would one use a windows exe in wine when there are q16 builds in almost EVERY operating system repos

imagemagick is so slow as it is that adding WINE to the mix is well ?????????????


All times are GMT -5. The time now is 04:38 AM.