Convert jpg with quality not properly

YongdeGe <[email protected]> Wed, 12 Sep 2018 20:12:51 +0800
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
Hi, All:

Now, I do some work to handle images with GM golang binding: https://github.com/rainycape/magick <https://github.com/rainycape/magick>. When I convert jpg file with quality 70 use the library, the quality of the jpg file is 34. As while, when I set quality to 88, the jpg file’s real quality change to 70. But, I use the gm command to do the same things, the qualities are all right.

Can some body to help me?

Some code like this:

// bs: original jpg raw data
image, err := magick.DecodeData(bs)
info := magick.NewInfo()
info.SetQuality(70)
info.SetFormat("jpg")
buf := &bytes.Buffer{}
err = image.Encode(buf, info)
// check err
// buf.Bytes(): convert jpg raw data

The GM Info:
GraphicsMagick 1.3.28 2018-01-20 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2018 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
  Native Thread Safe       yes
  Large Files (> 32 bit)   yes
  Large Memory (> 32 bit)  yes
  BZIP                     yes
  DPS                      no
  FlashPix                 no
  FreeType                 yes
  Ghostscript (Library)    no
  JBIG                     no
  JPEG-2000                no
  JPEG                     yes
  Little CMS               no
  Loadable Modules         no
  OpenMP                   yes (201107)
  PNG                      yes
  TIFF                     yes
  TRIO                     no
  UMEM                     no
  WebP                     yes
  WMF                      no
  X11                      yes
  XML                      no
  ZLIB                     yes

Host type: x86_64-unknown-linux-gnu

Configured using the command:
  ./configure  '--enable-prof' '--enable-shared'

Final Build Parameters:
  CC       = gcc -std=gnu99
  CFLAGS   = -p -fopenmp -g -O2 -Wall -pthread
  CPPFLAGS = -I/usr/include/freetype2
  CXX      = g++
  CXXFLAGS = -p -pthread
  LDFLAGS  = -p
  LIBS     = -lwebp -lwebpmux -ltiff -lfreetype -ljpeg -lpng15 -lXext -lX11 -llzma -lbz2 -lz -lm -lgomp -lpthread


Thanks!

_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help