reduce size of jpg image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

reduce size of jpg image

Post by manit »

I have photo.jpg of size 44KB its details are

Code: Select all

Image: d:\sumeet\photo.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 107x93+0+0
  Resolution: 72x72
  Print size: 1.48611x1.29167
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 213 (0.835294)
      mean: 129.192 (0.506634)
      standard deviation: 62.0548 (0.243352)
      kurtosis: -0.785709
      skewness: -0.816626
    Green:
      min: 1 (0.00392157)
      max: 227 (0.890196)
      mean: 133.496 (0.523514)
      standard deviation: 71.2028 (0.279227)
      kurtosis: -1.42149
      skewness: -0.443007
    Blue:
      min: 0 (0)
      max: 220 (0.862745)
      mean: 121.835 (0.477785)
      standard deviation: 72.5003 (0.284315)
      kurtosis: -1.69858
      skewness: -0.280016
  Image statistics:
    Overall:
      min: 0 (0)
      max: 227 (0.890196)
      mean: 128.174 (0.502645)
      standard deviation: 68.7433 (0.269582)
      kurtosis: -1.35769
      skewness: -0.481382
  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)
  Interlace: None
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 107x93+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 75
  Orientation: TopLeft
  Properties:
    date:create: 2013-04-17T15:35:39+01:00
    date:modify: 2013-04-16T12:30:44+01:00
    exif:ApertureValue: 7297/2500
    exif:ColorSpace: 1
    exif:ComponentsConfiguration: 1, 2, 3, 0
    exif:CompressedBitsPerPixel: 4/1
    exif:Compression: 6
    exif:DateTime: 2012:08:25 14:36:40
    exif:DateTimeDigitized: 2012:08:25 14:36:40
    exif:DateTimeOriginal: 2012:08:25 14:36:40
    exif:ExifImageLength: 268
    exif:ExifImageWidth: 308
    exif:ExifOffset: 200
    exif:ExifVersion: 48, 50, 50, 48
    exif:ExposureBiasValue: 0/10
    exif:ExposureMode: 0
    exif:ExposureProgram: 3
    exif:ExposureTime: 9997/200000
    exif:Flash: 1
    exif:FlashPixVersion: 48, 49, 48, 48
    exif:FNumber: 11/4
    exif:FocalLength: 343/100
    exif:InteroperabilityIndex: 
    exif:InteroperabilityOffset: 698
    exif:InteroperabilityVersion: 48, 49, 49, 48
    exif:ISOSpeedRatings: 50
    exif:JPEGInterchangeFormat: 878
    exif:JPEGInterchangeFormatLength: 41456
    exif:Make: SAMSUNG
    exif:MakerNote: 5, 0, 1, 0, 7, 0, 4, 0, 0, 0, 48, 49, 48, 48, 2, 0, 4, 0, 1, 0, 0, 0, 0, 32, 1, 0, 64, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 80, 0, 4, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    exif:MaxApertureValue: 11/4
    exif:MeteringMode: 2
    exif:Model: GT-I9103
    exif:Orientation: 1
    exif:ResolutionUnit: 2
    exif:SceneCaptureType: 0
    exif:ShutterSpeedValue: 43223/10000
    exif:Software: I9103XWKI5


    exif:thumbnail:Orientation: 1
    exif:thumbnail:ResolutionUnit: 2
    exif:thumbnail:XResolution: 72/1
    exif:thumbnail:YResolution: 72/1
    exif:UserComment: 65, 83, 67, 73, 73, 0, 0, 0, 0
    exif:WhiteBalance: 0

    exif:XResolution: 72/1
    exif:YCbCrPositioning: 1
    exif:YResolution: 72/1
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 7d6254264fcc105819446ef5690634b8fa145fb3481f438c6e421ccccac2d917



  Profiles:
    Profile-exif: 42340 bytes

  Artifacts:
    filename: d:\sumeet\photo.jpg
    verbose: true
  Tainted: False
  Filesize: 44.3KB
  Number pixels: 9.95K
  Pixels per second: 9.223372EB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.8.3-5 2013-02-24 Q16 http://www.imagemagick.org

I wanted to reduce file size to < 40K without altering dimensions .
Microsoft office picture manager did this & output file had specs

Code: Select all

Image: d:\sumeet\orig.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 107x93+0+0
  Resolution: 72x72
  Print size: 1.48611x1.29167
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 213 (0.835294)
      mean: 129.192 (0.506634)
      standard deviation: 62.0548 (0.243352)
      kurtosis: -0.785709
      skewness: -0.816626
    Green:
      min: 1 (0.00392157)
      max: 227 (0.890196)
      mean: 133.496 (0.523514)
      standard deviation: 71.2028 (0.279227)
      kurtosis: -1.42149
      skewness: -0.443007
    Blue:
      min: 0 (0)
      max: 220 (0.862745)
      mean: 121.835 (0.477785)
      standard deviation: 72.5003 (0.284315)
      kurtosis: -1.69858
      skewness: -0.280016
  Image statistics:
    Overall:
      min: 0 (0)
      max: 227 (0.890196)
      mean: 128.174 (0.502645)
      standard deviation: 68.7433 (0.269582)
      kurtosis: -1.35769
      skewness: -0.481382
  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)
  Interlace: None
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 107x93+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 75
  Orientation: TopLeft
  Properties:
    date:create: 2013-04-17T15:35:39+01:00
    date:modify: 2013-04-16T13:01:08+01:00
    exif:ApertureValue: 7297/2500
    exif:ColorSpace: 1
    exif:ComponentsConfiguration: 1, 2, 3, 0
    exif:CompressedBitsPerPixel: 4/1

    exif:DateTime: 2012:08:25 14:36:40
    exif:DateTimeDigitized: 2012:08:25 14:36:40
    exif:DateTimeOriginal: 2012:08:25 14:36:40
    exif:ExifImageLength: 268
    exif:ExifImageWidth: 308
    exif:ExifOffset: 2232
    exif:ExifVersion: 48, 50, 50, 48
    exif:ExposureBiasValue: 0/10
    exif:ExposureMode: 0
    exif:ExposureProgram: 3
    exif:ExposureTime: 9997/200000
    exif:Flash: 1
    exif:FlashPixVersion: 48, 49, 48, 48
    exif:FNumber: 11/4
    exif:FocalLength: 343/100



    exif:ISOSpeedRatings: 50


    exif:Make: SAMSUNG
    exif:MakerNote: 5, 0, 1, 0, 7, 0, 4, 0, 0, 0, 48, 49, 48, 48, 2, 0, 4, 0, 1, 0, 0, 0, 0, 32, 1, 0, 64, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 80, 0, 4, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    exif:MaxApertureValue: 11/4
    exif:MeteringMode: 2
    exif:Model: GT-I9103
    exif:Orientation: 1

    exif:SceneCaptureType: 0
    exif:ShutterSpeedValue: 43223/10000
    exif:Software: I9103XWKI5
    exif:SubSecTimeDigitized: 00
    exif:SubSecTimeOriginal: 00





    exif:WhiteBalance: 0
    exif:WinXP-Comments: 0, 0

    exif:YCbCrPositioning: 1

    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 7d6254264fcc105819446ef5690634b8fa145fb3481f438c6e421ccccac2d917
    unknown: 28, 234, 0, 0, 0, 8, 0, 0, 0, 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atorTool: I9103XWKI5
  Profiles:
    Profile-exif: 4810 bytes
    Profile-xmp: 2474 bytes
  Artifacts:
    filename: d:\sumeet\orig.jpg
    verbose: true
  Tainted: False
  Filesize: 9.6KB
  Number pixels: 9.95K
  Pixels per second: 9.223372EB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.8.3-5 2013-02-24 Q16 http://www.imagemagick.org

I fail to understand why imagemagick could not do that ?
Somehow I am not getting any option on this webpage to attach images talked about in this post.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: reduce size of jpg image

Post by magick »

convert image.jpg -define jpeg:extent=40kb myimage.jpg
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: reduce size of jpg image

Post by glennrp »

  • Profiles:
    Profile-exif: 42340 bytes
It'll be impossible to reduce the file to under 40kbytes if you keep the 42kbyte profile.

There is a directive for removing profiles; I don't remember the exact syntax now but
you can look it up in the documentation.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: reduce size of jpg image

Post by Bonzo »

-strip should do it glennrp

If you use -thumbnail instead of -resize it will do the same except keep the colour profile.
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: reduce size of jpg image

Post by manit »

convert photo.jpg -strip small,jpg
WORKED WELL , Image got reduced to 2kb without change in dimension
manit
Posts: 123
Joined: 2009-01-30T22:31:26-07:00

Re: reduce size of jpg image

Post by manit »

convert photo.jpg -define jpeg:extent=40kb myimage.jpg
did not work .
Myabe the default profile takes lot of space as pointed out by others,
Post Reply