Question

Using RaspiStill through a python process shell to take a picture with JPG encoding. I am getting a file that is over two megs. When I reduce the quality down to 50% the file size of the picture taken only drops the by about 200K, or less then a ten percent decrease. When I take that original 2 meg+ file and save it through Paint.Net with the quality set at 85 percent it drops the file size down to 300k, or almost a 90% decrease.

Am I doing something wrong, or is there something wrong with the encoder in RaspiStill?

Below is command line that I use to take the picture: pi@raspberrypi ~/Development/tests $ raspistill -n -t 100 -q 50 -e jpg -o fullsizejpgsethalfquality.jpg

Resulting File Size: 2052kb Resaving the same file though Paint.Net at 85% quality: 319kb

Thoughts?

Was it helpful?

Solution

This one took a lot of experimentation and an argument over at the Raspberry Pi Forum to solve.

Here is the link to the entire discussion: http://www.raspberrypi.org/forum/viewtopic.php?f=43&t=73174&p=527300#p527300

The stats on my final solution are as follows: I dropped the resolution down to 640x480, this produced a file size of 170k. I then dropped the quality down to 10, this is the equivalent to a quality value of 85 for most applications, and it dropped the file size down to 40k. Finally I turned off the thumbnail, which is stored as a bitmap, and it resulted in a final file size of 20k... which is what you would expect from a jpeg that size and quality settings. Here is the final command I used:

pi@raspberrypi ~/Development/tests $ raspistill -w 640 -h 480 -n -t 100 -q 10 -e jpg -th none -o vgasize10nothumb.jpg

The main problem stemmed from how Raspistill interprets the quality value. It uses it as an logarithmic-esk value where there is almost no change from 100 all the way down to 10. The the quality drops off a cliff going down from 10-1. A rather insane development decision IMHO.

As I stated a value of 10 is about the same quality as 85 for most graphics apps, which gives a good apparent quality with a very small file. And is the point of using Jpeg in the first place.

OTHER TIPS

I also had some issues with the -q (--quality) parameter and didn't undertand it very well, however, why don't you try with --width and --height? That should give you a solution, look:

 raspistill --width 1280 --height 960 --quality 100 -o fullsizejpgsethalfquality3.jpg

I added --quality but you can ignore it I guess. If I list the contents of the diretory you see 3 different pics. The first two have lkept the full resolution and playing with the -q parameter:

-rw-r--r-- 1 pi pi 1691812 mar 27 16:57 fullsizejpgsethalfquality.jpg
-rw-r--r-- 1 pi pi 1492051 mar 27 16:57 fullsizejpgsethalfquality2.jpg
-rw-r--r-- 1 pi pi  351976 mar 27 17:00 fullsizejpgsethalfquality3.jpg

Look at the size, it's a 5 times lighter photo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top