Unexpected dots appears on png converted by bmp.
Swiss army knife of image processing
Brought to you by:
bfriesen
https://sourceforge.net/p/graphicsmagick/discussion/250738/thread/5c6a6d9387/
Unexpected dots have found when converting a bmp into png when using the command:
convert -auto-orient -scale 200x -gravity Center -crop 200x130+0+0 -quality 75 -strip test.bmp png:dest.png
Please help check the reason! Thanks.
I have tested this command on two different computers with different build options and am not seeing any misbehavior at all. I do not have OS X to test with.
As previously requested, please add '-limit threads 1' immediately after 'convert' and see if the problem goes away.
Also, please include the complete output of 'gm -version' and 'gm convert -list formats' into this bug report.
What is the origin of the GraphicsMagick you are using?
Thanks,
Bob
Hello Bob,
Adding "-limit threads 1" does solve the problem. And I notice that the problem only occurs when I deal with bmp. Dealing jpg with same command just work properly.
=========gm -version result=========
GraphicsMagick 1.3.33 2019-07-20 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2019 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
Solaris mtmalloc no
OpenMP yes (200805 "3.0")
PNG yes
TIFF yes
TRIO no
Solaris umem no
WebP yes
WMF no
X11 no
XML yes
ZLIB yes
Host type: x86_64-pc-linux-gnu
Configured using the command:
./configure
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/local/include/freetype2 -I/usr/include/libxml2
CXX = g++
CXXFLAGS = -pthread
LDFLAGS = -L/usr/local/lib
LIBS = -lwebp -ltiff -lfreetype -ljpeg -lpng16 -lbz2 -lxml2 -lz -lm -lpthread
=========gm convert list formats=========
Format L Mode Description
8BIMTEXT P rw- Photoshop resource text format
8BIMWTEXT P rw- Photoshop resource wide text format
APP1 P rw- Raw application information
APP1JPEG P rw- Raw JPEG binary data
ART S rw- PFS: 1st Publisher
ARW S r-- Sony Alpha DSLR RAW
AVS U rw+ AVS X image
B S rw+ Raw blue samples
BIGTIFF P rw+ Tagged Image File Format (64-bit offsets)
BMP P rw- Microsoft Windows bitmap image
BMP2 P -w- Microsoft Windows bitmap image v2
BMP3 P -w- Microsoft Windows bitmap image v3
BRF S -w- BRF ASCII Braille format
C S rw+ Raw cyan samples
CACHE U --- Magick Persistent Cache image format
CALS S rw- Continuous Acquisition and Life-cycle Support Type 1 image
Specified in MIL-R-28002 and MIL-PRF-28002
CAPTION P r-- Image caption
CIN S rw- Cineon Image File
CMYK S rw+ Raw cyan, magenta, yellow, and black samples
CMYKA S rw+ Raw cyan, magenta, yellow, black, and opacity samples
CR2 S r-- Canon Photo RAW
CRW S r-- Canon Photo RAW
CUR S r-- Microsoft Cursor Icon
CUT S r-- DR Halo
DCM S r-- Digital Imaging and Communications in Medicine image
See http://medical.nema.org/ for information on DICOM.
DCR S r-- Kodak Photo RAW
DCX S rw+ ZSoft IBM PC multi-page Paintbrush
DNG S r-- Adobe Digital Negative
DPX P rw- SMPTE 268M-2003 (DPX 2.0)
See http://www.smtpe.org/ for information on DPX.
EPDF P rw- Encapsulated Portable Document Format
EPI P rw- Adobe Encapsulated PostScript Interchange format
EPS P rw- Adobe Encapsulated PostScript
EPS2 P -w- Adobe Level II Encapsulated PostScript
EPS3 P -w+ Adobe Level III Encapsulated PostScript
EPSF P rw- Adobe Encapsulated PostScript
EPSI P rw- Adobe Encapsulated PostScript Interchange format
EPT P rw- Adobe Encapsulated PostScript with MS-DOS TIFF preview
EPT2 P rw- Adobe Level II Encapsulated PostScript with MS-DOS TIFF preview
EPT3 P rw- Adobe Level III Encapsulated PostScript with MS-DOS TIFF preview
ERF S r-- Epson RAW Format
EXIF P rw- Exif digital camera binary data
FAX P rw+ Group 3 FAX (Not TIFF Group3 FAX!)
FILE S r-- Uniform Resource Locator (file://)
FITS S rw- Flexible Image Transport System
FRACTAL S r-- Plasma fractal image
FTP U r-- Uniform Resource Locator (ftp://)
G S rw+ Raw green samples
GIF P rw+ CompuServe graphics interchange format (version 89a)
GIF87 P rw- CompuServe graphics interchange format (version 87a)
GRADIENT P r-- Gradual passing from one shade to another
GRAY S rw+ Raw gray samples
GRAYA S rw+ Raw gray samples + alpha
HISTOGRAM P -w- Histogram of the image
HRZ S r-- HRZ: Slow scan TV
HTML S -w- Hypertext Markup Language and a client-side image map
HTTP U r-- Uniform Resource Locator (http://)
ICB S rw+ Truevision Targa image
ICC P rw- ICC Color Profile
ICM P rw- ICC Color Profile
ICO S r-- Microsoft Icon
ICON S r-- Microsoft Icon
IDENTITY P r-- Hald CLUT identity image
IMAGE P r-- GraphicsMagick Embedded Image
INFO S -w+ Image descriptive information and statistics
IPTC P rw- IPTC Newsphoto
IPTCTEXT P rw- IPTC Newsphoto text format
IPTCWTEXT P rw- IPTC Newsphoto text format
ISOBRL S -w- ISO/TR 11548-1 format
ISOBRL6 S -w- ISO/TR 11548-1 format 6dot
JNG S rw- JPEG Network Graphics (libpng 1.6.13, zlib 1.2.8)
See http://www.libpng.org/pub/mng/ for information on JNG.
JNX S r-- JNX: Garmin tile storage format
JPEG P rw- Joint Photographic Experts Group JFIF format (IJG JPEG 62)
JPG P rw- Joint Photographic Experts Group JFIF format (IJG JPEG 62)
K S rw+ Raw black samples
K25 S r-- Kodak Photo RAW
KDC S r-- Kodak Photo RAW
LABEL P r-- Image label
M S rw+ Raw magenta samples
M2V S -w+ MPEG Video Stream
MAC S r-- Mac Paint
MAP U rw- Colormap intensities and indices
MAT S rw+ MATLAB Level 4.0-7.0 image formats
MATTE S -w+ MATTE raw opacity format
MEF S r-- Mamiya Photo RAW
MIFF P rw+ Magick Image File Format (GraphicsMagick 1.3.33, Zlib 1.2.8, BZlib)
MNG S rw+ Multiple-image Network Graphics (libpng 1.6.13, zlib 1.2.8)
See http://www.libpng.org/pub/mng/ for information on MNG.
MONO S rw- Bi-level bitmap in least-significant-byte first order
MPC U rw+ Magick Persistent Cache image format
MPEG S -w+ MPEG Video Stream
MPG S -w+ MPEG Video Stream
MRW S r-- Minolta Photo RAW
MSL S rw+ Magick Scripting Language
MTV U rw+ MTV Raytracing image format
MVG S rw- Magick Vector Graphics
NEF S r-- Nikon Electronic Format
NULL P rw- Constant image of uniform color
O S rw+ Raw opacity samples
ORF S r-- Olympus Photo RAW
OTB S rw- On-the-air bitmap
P7 S rw+ Xv thumbnail format
PAL S rw- 16bit/pixel interleaved YUV
PALM U r-- Palm pixmap
PAM P rw+ Portable Arbitrary Map format
PBM P rw+ Portable bitmap format (black/white)
PCD S rw- Photo CD
PCDS S rw- Photo CD
PCL S -w+ Page Control Language
PCT S rw- Apple Macintosh QuickDraw/PICT
PCX S rw- ZSoft IBM PC Paintbrush
PDB U rw+ Palm Database ImageViewer Format
PDF P rw+ Portable Document Format
PEF S r-- Pentax Electronic File
PFA P r-- Postscript Type 1 font (ASCII) (FreeType 2.10.1)
PFB P r-- Postscript Type 1 font (binary) (FreeType 2.10.1)
PGM P rw+ Portable graymap format (gray scale)
PICON S rw- Personal Icon
PICT S rw- Apple Macintosh QuickDraw/PICT
PIX S r-- Alias/Wavefront RLE image format
PLASMA S r-- Plasma fractal image
PNG P rw- Portable Network Graphics (libpng 1.6.13, zlib 1.2.8)
See http://www.libpng.org/ for information on PNG..
PNG00 P rw- PNG that inherits type and depth from original (libpng 1.6.13, zlib 1.2.8)
PNG24 P rw- 24-bit RGB PNG, opaque only (libpng 1.6.13, zlib 1.2.8)
PNG32 P rw- 32-bit RGBA PNG, semitransparency OK (libpng 1.6.13, zlib 1.2.8)
PNG48 P rw- opaque or binary transparent 48-bit RGB (libpng 1.6.13, zlib 1.2.8)
PNG64 P rw- opaque or transparent 64-bit RGBA (libpng 1.6.13, zlib 1.2.8)
PNG8 P rw- 8-bit indexed PNG, binary transparency only (libpng 1.6.13, zlib 1.2.8)
PNM P rw+ Portable anymap
PPM P rw+ Portable pixmap format (color)
PREVIEW S -w- Show a preview an image enhancement, effect, or f/x
PS P rw+ Adobe PostScript
PS2 P -w+ Adobe Level II PostScript
PS3 P -w+ Adobe Level III PostScript
PTIF S rw+ Pyramid encoded TIFF
PWP U r-- Seattle Film Works
R S rw+ Raw red samples
RAF S r-- Fuji Photo RAW
RAS S rw+ SUN Rasterfile
RGB S rw+ Raw red, green, and blue samples
RGBA S rw+ Raw red, green, blue, and matte samples
RLA U r-- Alias/Wavefront image
RLE U r-- Utah Run length encoded image
SCT U r-- Scitex HandShake
SFW U r-- Seattle Film Works
SGI S rw- Irix RGB image
SHTML S -w- Hypertext Markup Language and a client-side image map
SR2 S r-- Sony Photo RAW
SRF S r-- Sony Photo RAW
STEGANO S r-- Steganographic image
SUN S rw+ SUN Rasterfile
SVG S r-- Scalable Vector Graphics (XML 2.7.6)
SVGZ S r-- Scalable Vector Graphics (ZIP compressed) (XML 2.7.6)
TEXT S rw+ ASCII Text
TGA S rw+ Truevision Targa image
TIFF P rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
TILE P r-- Tile image with a texture
Use the syntax "-size WIDTHxHEIGHT TILE:imagename" to tile the
specified tile image over a canvas image of size WIDTHxHEIGHT.
TIM S r-- PSX TIM
TOPOL S r-- TOPOL X Image
TTF P r-- TrueType font (FreeType 2.10.1)
TXT S rw+ ASCII Text
UBRL S -w- Unicode Text format
UBRL6 S -w- Unicode Text format 6dot
UIL U -w- X-Motif UIL table
UYVY S rw- 16bit/pixel interleaved YUV
VDA S rw+ Truevision Targa image
VICAR S rw- VICAR rasterfile format
VID S rw+ Visual Image Directory
VIFF S rw+ Khoros Visualization image
VST S rw+ Truevision Targa image
WBMP S rw- Wireless Bitmap (level 0) image
WEBP P rw- WebP Image Format (libwepb v0.4.2, ENCODER ABI 0x0202)
WPG S r-- Word Perfect Graphics
X3F S r-- Foveon X3 (Sigma/Polaroid) RAW
XBM S rw- X Windows system bitmap (black/white)
XC P r-- Constant image uniform color
XCF S r-- GIMP image
XMP P rw- Adobe XML metadata
XPM S rw- X Windows system pixmap (color)
XV S rw+ Khoros Visualization image
Y S rw+ Raw yellow samples
YUV S rw- CCIR 601 4:1:1 or 4:2:2 (8-bit only)
Meaning of 'L': P=Primary, S=Stable, U=Unstable
On Wed, 25 Dec 2019, shirley Wang wrote:
That is unfortunate. It is fortunate that there is a solution
(disable OpenMP threading) but unfortunate that unless I can reproduce
the problem it will be difficult to solve.
The next thing to do is to take your original command and remove the
-auto-orient, -scale, and -crop sub-commands individually and see
if/when the dots disappear.
Assuming that you compiled GraphicsMagick from source code, what
does 'gcc --version' report? The version of gcc must be very old,
since even GCC 4.7.1 from 2012 reports an OpenMP version of 201107
"3.1". I do have some older versions of GCC here and I might be able
to reproduce something close to the version you are using if I know
what it is.
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt
The gcc -version I'm using is gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) , surely it's earlier than the 4.7.1 version :(
I'll try to remove sub-commands later, thx.
On Fri, 27 Dec 2019, shirley Wang wrote:
It looks like I have gcc 4.4.6 available to me. Maybe it still works.
If so, I will test with it.
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt
I compiled GraphicsMagick using GCC 4.4.6, but unfortunately, I am not able to reproduce the problem. My testing is done under Solaris rather than Linux since that is where I built this old compiler. Unfortunately, the issue can easily be system-specific since OpenMP behavior is influenced by the hardware and OS.
How many CPU cores do you have? One way to find out is by doing
gm convert -list resources
and see what number is reported for 'Threads'. In my case I only have 4 real cores on the system I tested on, but I also requested 32 threads and still did not see an issue.
You should still test your command with requests removed (perhaps starting with no requests at all so it is a simple convert from one file to another) until you find the one which introduces the glitch.
The "gm convert-list resources" shows there're 24 threads. I'm a little busy these days, when I get time I'll try testing the commands.
We are all a little busy these days. Since I am not able to reproduce the problem, this issue will be closed in a couple of weeks unless I am too busy to remember.
Otherwise, if you can provide some assistance from your end, maybe the underlying cause can be discovered.
I am unable to reproduce this issue. The person who reported the issue is unable to provide any assistance from their end. Closing this issue until it can be reproduced.