imagemagick
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not imagemagick’s official test suite, and the imagemagick project is not affiliated with atago.
Summary #
1 suite · 13 scenarios
Contents #
- ImageMagick (image conversion pipeline) — 13 scenarios
- a conversion writes the requested format and nothing else
- resize honors the aspect ratio unless it is forced
- a 1x1 canvas survives the smallest possible conversion
- an alpha channel survives PNG but is dropped by JPEG
- a PNG to PPM round trip restores the original pixels
- comparing different images reports a nonzero difference
- the JSON report describes the image it just wrote
- strip removes an embedded comment from the output bytes
- a missing input fails without writing an output
- a corrupt input is rejected rather than converted
- an unknown output extension keeps the input encoding
- identify reads the dimensions back out of a written file
- identify on a missing file fails and prints nothing to stdout
ImageMagick (image conversion pipeline) #
ImageMagick converts, resizes, and inspects images. What this suite pins is the part a converter must not get wrong: that the file it wrote really is the image it claims.
Every output is decoded and checked as an image — format, pixel
dimensions, alpha channel — never merely “a file appeared”. A lossless
round trip is verified twice over: once by atago comparing the pixels
against the original, and once by ImageMagick’s own compare -metric AE,
an independent oracle that has to agree. The failure side is pinned per
kind (missing input, corrupt input, unwritable format), and the input
images are always generated by the tool itself, so the suite carries no
third-party assets.
Source: test/e2e/thirdparty/imagemagick/imagemagick.atago.yaml
Scenario: a conversion writes the requested format and nothing else #
only when magick -version succeeds
Given #
- The command runs with an isolated home under
${workdir}/.atago-home(HOME/XDG or APPDATA redirected).
When #
magick -size 8x6 xc:red source.png
magick source.png out.jpg
Then #
- after
magick -size 8x6 xc:red source.png:- exit code is
0
- exit code is
- after
magick source.png out.jpg:- exit code is
0 - the step changed exactly created
out.jpg, modified nothing, deleted nothing - image
out.jpgisjpeg, width 8, height 6
- exit code is
Generated artifacts #
out.jpg
Scenario: resize honors the aspect ratio unless it is forced #
only when magick -version succeeds
When #
magick -size 40x20 xc:white source.png
magick source.png -resize 20x20 fitted.png
magick source.png -resize 20x20! forced.png
Then #
- after
magick -size 40x20 xc:white source.png:- exit code is
0
- exit code is
- after
magick source.png -resize 20x20 fitted.png:- exit code is
0 - image
fitted.pngwidth 20, height 10
- exit code is
- after
magick source.png -resize 20x20! forced.png:- exit code is
0 - image
forced.pngwidth 20, height 20
- exit code is
Generated artifacts #
fitted.pngforced.png
Scenario: a 1x1 canvas survives the smallest possible conversion #
only when magick -version succeeds
When #
magick -size 1x1 xc:black tiny.png
Then #
- exit code is
0 - image
tiny.pngispng, width 1, height 1
Generated artifacts #
tiny.png
Scenario: an alpha channel survives PNG but is dropped by JPEG #
only when magick -version succeeds
When #
magick -size 8x6 xc:none transparent.png
magick transparent.png -background white -flatten flat.jpg
Then #
- after
magick -size 8x6 xc:none transparent.png:- exit code is
0 - image
transparent.pngispng, has alpha
- exit code is
- after
magick transparent.png -background white -flatten flat.jpg:- exit code is
0 - image
flat.jpgisjpeg, has no alpha
- exit code is
Generated artifacts #
transparent.pngflat.jpg
Scenario: a PNG to PPM round trip restores the original pixels #
only when magick -version succeeds
When #
magick -size 16x12 gradient:red-blue source.png
magick source.png intermediate.ppm
magick intermediate.ppm restored.png
magick compare -metric AE source.png restored.png null:
Then #
- after
magick -size 16x12 gradient:red-blue source.png:- exit code is
0
- exit code is
- after
magick source.png intermediate.ppm:- exit code is
0
- exit code is
- after
magick intermediate.ppm restored.png:- exit code is
0 - image
restored.pngsimilar tosource.png
- exit code is
- after
magick compare -metric AE source.png restored.png null::- exit code is
0
- exit code is
Generated artifacts #
restored.png
Scenario: comparing different images reports a nonzero difference #
only when magick -version succeeds
When #
magick -size 8x6 xc:red red.png
magick -size 8x6 xc:blue blue.png
magick compare -metric AE red.png blue.png null:
Then #
- after
magick -size 8x6 xc:red red.png:- exit code is
0
- exit code is
- after
magick -size 8x6 xc:blue blue.png:- exit code is
0
- exit code is
- after
magick compare -metric AE red.png blue.png null::- exit code is
1 - stderr contains
48
- exit code is
Scenario: the JSON report describes the image it just wrote #
only when magick -version succeeds
When #
magick -size 24x18 xc:red report.png
magick report.png json:
Then #
- after
magick -size 24x18 xc:red report.png:- exit code is
0
- exit code is
- after
magick report.png json::- exit code is
0 - stdout at
$[0].image.formatequalsPNG; at$[0].image.geometry.widthequals24; at$[0].image.geometry.heightequals18; at$[0].image.mimeTypeequalsimage/png
- exit code is
Scenario: strip removes an embedded comment from the output bytes #
only when magick -version succeeds
When #
magick -size 8x6 xc:red -set comment CONFIDENTIAL-MARK marked.png
magick marked.png -strip stripped.png
Then #
- after
magick -size 8x6 xc:red -set comment CONFIDENTIAL-MARK marked.png:- exit code is
0 - file
marked.pngcontainsCONFIDENTIAL-MARK
- exit code is
- after
magick marked.png -strip stripped.png:- exit code is
0 - file
stripped.pngdoes not containCONFIDENTIAL-MARK - image
stripped.pngsimilar tomarked.png
- exit code is
Generated artifacts #
stripped.png
Scenario: a missing input fails without writing an output #
only when magick -version succeeds
When #
magick no-such-input.png out.png
Then #
- exit code is
1 - stdout is empty
- stderr contains
no-such-input.png - file
out.pngdoes not exist
Scenario: a corrupt input is rejected rather than converted #
only when magick -version succeeds
Given #
- Fixture file
broken.pngis created.
Inputs #
Fixture broken.png:
this is not a PNG at all
When #
magick broken.png out.png
Then #
- exit code is
1 - stdout is empty
- stderr contains
broken.png - file
out.pngdoes not exist
Scenario: an unknown output extension keeps the input encoding #
only when magick -version succeeds
When #
magick -size 8x6 xc:red source.png
magick source.png out.notaformat
Then #
- after
magick -size 8x6 xc:red source.png:- exit code is
0
- exit code is
- after
magick source.png out.notaformat:- exit code is
0 - image
out.notaformatispng, width 8, height 6
- exit code is
Generated artifacts #
out.notaformat
Scenario: identify reads the dimensions back out of a written file #
only when magick -version succeeds
When #
magick -size 37x11 xc:gray sized.png
magick identify -format "%wx%h %m" sized.png
Then #
- after
magick -size 37x11 xc:gray sized.png:- exit code is
0
- exit code is
- after
magick identify -format "%wx%h %m" sized.png:- exit code is
0 - stdout equals an exact value
- exit code is
Scenario: identify on a missing file fails and prints nothing to stdout #
only when magick -version succeeds
When #
magick identify absent.png
Then #
- exit code is
1 - stdout is empty
- stderr contains
absent.png