Sample Header Ad - 728x90

How to use jpegoptim to have files only 20kb in size?

0 votes
2 answers
527 views
I have tried using jpegoptim and even tried the manpage but am stumped. Here is a file I want to reduce to 50k and even open to reducing quality of the data - Image: Filename: shirish.jpg Format: JPEG (Joint Photographic Experts Group JFIF format) Mime type: image/jpeg Class: DirectClass Geometry: 4624x3468+0+0 Resolution: 72x72 Print size: 64.2222x48.1667 Units: PixelsPerInch Colorspace: sRGB Type: TrueColor Base type: Undefined Endianness: Undefined Depth: 8-bit Channel depth: red: 8-bit green: 8-bit blue: 8-bit Channel statistics: Pixels: 16036032 Red: min: 0 (0) max: 255 (1) mean: 119.779 (0.46972) standard deviation: 60.359 (0.236702) kurtosis: -1.33094 skewness: -0.2895 entropy: 0.920909 Green: min: 0 (0) max: 255 (1) mean: 115.071 (0.45126) standard deviation: 63.5402 (0.249177) kurtosis: -1.51367 skewness: -0.162973 entropy: 0.912909 Blue: min: 0 (0) max: 255 (1) mean: 114.566 (0.449277) standard deviation: 61.8685 (0.242621) kurtosis: -1.51015 skewness: -0.101152 entropy: 0.912805 Image statistics: Overall: min: 0 (0) max: 255 (1) mean: 116.472 (0.456752) standard deviation: 61.9226 (0.242834) kurtosis: -1.46062 skewness: -0.184944 entropy: 0.915541 Rendering intent: Perceptual Gamma: 0.454545 Chromaticity: red primary: (0.64,0.33) green primary: (0.3,0.6) blue primary: (0.15,0.06) white point: (0.3127,0.329) Background color: white Border color: srgb(223,223,223) Matte color: grey74 Transparent color: black Interlace: None Intensity: Undefined Compose: Over Page geometry: 4624x3468+0+0 Dispose: Undefined Iterations: 0 Compression: JPEG Quality: 92 Orientation: RightTop Profiles: Profile-app4: 7600 bytes Profile-exif: 51509 bytes Properties: date:create: 2022-08-20T05:27:53+00:00 date:modify: 2022-08-20T05:27:53+00:00 exif:ApertureValue: 169/100 exif:BrightnessValue: 264/100 exif:ColorSpace: 1 exif:DateTime: 2022:08:20 10:53:10 exif:DateTimeDigitized: 2022:08:20 10:53:10 exif:DateTimeOriginal: 2022:08:20 10:53:10 exif:DigitalZoomRatio: 100/100 exif:ExifOffset: 226 exif:ExifVersion: 48, 50, 50, 48 exif:ExposureMode: 0 exif:ExposureProgram: 2 exif:ExposureTime: 1/50 exif:Flash: 0 exif:FNumber: 180/100 exif:FocalLength: 532/100 exif:FocalLengthIn35mmFilm: 28 exif:ImageLength: 3468 exif:ImageUniqueID: I64ELODR0PM exif:ImageWidth: 4624 exif:Make: samsung exif:MaxApertureValue: 169/100 exif:MeteringMode: 2 exif:Model: SM-M526B exif:OffsetTime: +05:30 exif:OffsetTimeOriginal: +05:30 exif:PhotographicSensitivity: 160 exif:PixelXDimension: 4624 exif:PixelYDimension: 3468 exif:SceneCaptureType: 0 exif:ShutterSpeedValue: 1/50 exif:Software: M526BXXU1BVG4 exif:thumbnail:Compression: 6 exif:thumbnail:ImageLength: 384 exif:thumbnail:ImageWidth: 512 exif:thumbnail:JPEGInterchangeFormat: 782 exif:thumbnail:JPEGInterchangeFormatLength: 50721 exif:thumbnail:ResolutionUnit: 2 exif:thumbnail:XResolution: 72/1 exif:thumbnail:YResolution: 72/1 exif:WhiteBalance: 0 exif:YCbCrPositioning: 1 jpeg:colorspace: 2 jpeg:sampling-factor: 2x2,1x1,1x1 signature: 7841c1e0cbe1aa5b79f0dea6791ffd321e2cf05715a9ab3cd210fd551c9bf355 Artifacts: filename: shirish.jpg verbose: true Tainted: False Filesize: 3.65599MiB Number pixels: 16.036M Pixels per second: 126.41MB User time: 0.120u Elapsed time: 0:01.126 Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org Now I tried both imagemagick convert as well as jpegoptim to get a file which is around 50k. I need the file at that size as I have to upload it somewhere and there are size contraints. I got the above exif and photo data using the identify -verbose switch in imagemagick. Could somebody help me in the above. I did try the following - $jpegoptim --size=50k shirish.jpg Instead of 50kb I got a file that is 200 kb, good but not what I wanted :( I even tried - $jpegoptim --max=10 --size=50k shirish-aadhar-2-reduced.jpg But even that did not produce the desired results. $ jpegoptim --version jpegoptim v1.4.7 x86_64-pc-linux-gnu (Jun 20 2022) Copyright (C) 1996-2022, Timo Kokkonen This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistirbute it under certain conditions. See the GNU General Public License for more details. libjpeg version: 6b 27-Mar-1998 Copyright (C) 1991-2021 The libjpeg-turbo Project and many others Looking forward for help. I know I could use some online tool for the same, but would like offline it possible.
Asked by shirish (12954 rep)
Aug 20, 2022, 06:08 AM
Last activity: Aug 20, 2022, 04:28 PM