Criizly
Criizly

Reputation: 41

Mac Automator Image Conversion

I'm taking screenshots of images (with white background) and they are appearing on the desktop as .png files, I then use a Automator script to convert them to .jpg images, but some of the images are actually growing in file size when I do it.

The original image is 63KB in PNG format, then it goes to 85KB after conversion, which has left me confused because I thought JPG was supposed to be the lossy format?

Is there anyway to fix this problem in automator by specifying that it should convert the image at a lower quality?

Also, I can use a meta data stripper to shave off a few KB, it gets rid of metadata about the height and width of the image, is this going to cause me problems when I attempt to use the image in a web page or eBook later on?

Upvotes: 0

Views: 581

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207668

You can change the saved image type for screen captures like this:

defaults write com.apple.screencapture type jpg

or

defaults write com.apple.screencapture type png

By the way, for stripping, I use

jhead -purejpg file.jpg

Stripping does not normally cause any problems, as all tools can still get the image size. If you want complete control over the quality, I would suggest ImageMagick which is available for free - and easily installed with homebrew.

Example:

convert a.jpg -quality 50% 50.jpg
convert a.jpg -quality 10% 10.jpg
convert a.jpg -quality 80% 80.jpg


ls -l [0-9]*jpg a.jpg
-rw-r--r--  1 mark  staff   50743 29 May 16:48 10.jpg
-rw-r--r--  1 mark  staff  120460 29 May 16:48 50.jpg
-rw-r--r--  1 mark  staff  187818 29 May 16:48 80.jpg
-rw-r--r--  1 mark  staff  284821 29 May 16:47 a.jpg

Note that the lower quality images come out as smaller files.

Upvotes: 1

Related Questions