User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 9:55 pm

Is there a secret to making a jpg smaller so as we can use as an avatar? If I keep resizing my jpg it becomes unrecognisable at 30kb, yet i see some pretty cool avatars here so it must be possible.


Are there any secrets to doing this?

Cheers
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 9:59 pm

Convert it to GIF then convert it back to JPG. GIF reduces the colour map to 256 but doesn't lose too much detail.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 10:11 pm

Dougie you seem to be my saviour of late, thanks again.

Although when I saved the GIF back to JPG its filesize grew back to original size, but the GIF was down at 5kb, so i ended up using that one.

Thanks again.
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 10:14 pm

it seems to have worked. :D

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 10:43 pm

By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13099
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Secret to making an avatar <= 6kb???

Sun Mar 08, 2015 11:06 pm

yeah, for some reason some media liked to publish "non-flattering" pictures of him....

User avatar
Mandrewpi
Posts: 339
Joined: Sat Dec 06, 2014 2:58 am

Re: Secret to making an avatar <= 6kb???

Tue Mar 10, 2015 1:14 am

How do you upload images for your avatar? I went to the avatar page browsed for an avatar pic on my phone (within all requirements) but I tried to save it and it doesn't show up :?: :|
A computer is only as smart as its programmer. ;)

I own:
Pi B rev.2, Pi 2 B, Two Pi 3 B, Two Pi 3 b+, Pi 4 2Gb, Pi Zero 1.2, Pi Zero 1.3, Two Pi Zero Ws.
I'm known elsewhere as mandrew1444

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: Secret to making an avatar <= 6kb???

Tue Mar 10, 2015 3:36 am

Mandrewpi wrote:How do you upload images for your avatar? I went to the avatar page browsed for an avatar pic on my phone (within all requirements) but I tried to save it and it doesn't show up :?: :|
Haven't changed avatar using my phone, have you tried on a PC? Go to user Control Panel, Profile then Edit Avatar...
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
Mandrewpi
Posts: 339
Joined: Sat Dec 06, 2014 2:58 am

Re: Secret to making an avatar <= 6kb???

Tue Mar 10, 2015 11:55 pm

Yea that didn't work either, I will just go without one for now :(
A computer is only as smart as its programmer. ;)

I own:
Pi B rev.2, Pi 2 B, Two Pi 3 B, Two Pi 3 b+, Pi 4 2Gb, Pi Zero 1.2, Pi Zero 1.3, Two Pi Zero Ws.
I'm known elsewhere as mandrew1444

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: Secret to making an avatar <= 6kb???

Thu Mar 12, 2015 4:57 am

Mandrewpi wrote:Yea that didn't work either, I will just go without one for now :(
Can you screenshot what you can/cannot see on your control panel for us to see?
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Secret to making an avatar <= 6kb???

Thu Mar 12, 2015 8:53 am

DougieLawson wrote:Convert it to GIF then convert it back to JPG. GIF reduces the colour map to 256 but doesn't lose too much detail.
How are you making your avatars? I think you would get a better looking avatar by decreasing the "quality" (when saving your JPEG) in the image manipulation program you are using, until you reach the desired size. A small amount of Gaussian blur will often reduce the size of the file.

When you quantize a 24 bit-per-pixel image to a 256-colour palette, the image will often be dithered to randomize the resulting errors. This increases the noise in the image and may reduce the amount of (JPEG) compression.

The size of the uncompressed avatar is 90 x 90 x 3 =24,300 bytes, and needs to be compressed to 6 KiB (6,144 bytes). So needs to be compressed to around 25% of the original (including headers etc).

When using JPEG compression, the size of the resulting file depends on a number of things:
  • The amount of metadata in the APP* segments (exif, thumbnails, etc)
  • The amount of "information" in the original image
  • The "quality" (amount of quantization of the discrete cosine transform coefficients)
  • The amount of chroma sub-sampling (4:4:4. 4:2:2 or 4:2:0, these often kick in a specific quality values)
  • Baseline vs "optimized" Huffman encoding
"Quality" and chroma sub-sampling can often be selected when you save the file.
You can use jpegtran (found in the libjpeg-progs package) to remove metadata and create optimized Huffman tables, without recalculating the DCT or re-quantizing.

Return to “Off topic discussion”