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 convert -version succeeds
Given #
- The command runs with an isolated home under
${workdir}/.atago-home(HOME/XDG or APPDATA redirected).
When #
convert -size 8x6 xc:red source.png
convert source.png out.jpg
Then #
- after
convert -size 8x6 xc:red source.png:- exit code is
0
- exit code is
- after
convert 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 convert -version succeeds
When #
convert -size 40x20 xc:white source.png
convert source.png -resize 20x20 fitted.png
convert source.png -resize 20x20! forced.png
Then #
- after
convert -size 40x20 xc:white source.png:- exit code is
0
- exit code is
- after
convert source.png -resize 20x20 fitted.png:- exit code is
0 - image
fitted.pngwidth 20, height 10
- exit code is
- after
convert 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 convert -version succeeds
When #
convert -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 convert -version succeeds
When #
convert -size 8x6 xc:none transparent.png
convert transparent.png -background white -flatten flat.jpg
Then #
- after
convert -size 8x6 xc:none transparent.png:- exit code is
0 - image
transparent.pngispng, has alpha
- exit code is
- after
convert 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 convert -version succeeds
When #
convert -size 16x12 gradient:red-blue source.png
convert source.png intermediate.ppm
convert intermediate.ppm restored.png
compare -metric AE source.png restored.png null:
Then #
- after
convert -size 16x12 gradient:red-blue source.png:- exit code is
0
- exit code is
- after
convert source.png intermediate.ppm:- exit code is
0
- exit code is
- after
convert intermediate.ppm restored.png:- exit code is
0 - image
restored.pngsimilar tosource.png
- exit code is
- after
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 convert -version succeeds
When #
convert -size 8x6 xc:red red.png
convert -size 8x6 xc:blue blue.png
compare -metric AE red.png blue.png null:
Then #
- after
convert -size 8x6 xc:red red.png:- exit code is
0
- exit code is
- after
convert -size 8x6 xc:blue blue.png:- exit code is
0
- exit code is
- after
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 convert -version succeeds
When #
convert -size 24x18 xc:red report.png
convert report.png json:
Then #
- after
convert -size 24x18 xc:red report.png:- exit code is
0
- exit code is
- after
convert 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 convert -version succeeds
When #
convert -size 8x6 xc:red -set comment CONFIDENTIAL-MARK marked.png
convert marked.png -strip stripped.png
Then #
- after
convert -size 8x6 xc:red -set comment CONFIDENTIAL-MARK marked.png:- exit code is
0 - file
marked.pngcontainsCONFIDENTIAL-MARK
- exit code is
- after
convert 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 convert -version succeeds
When #
convert 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 convert -version succeeds
Given #
- Fixture file
broken.pngis created.
Inputs #
Fixture broken.png:
this is not a PNG at all
When #
convert 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 convert -version succeeds
When #
convert -size 8x6 xc:red source.png
convert source.png out.notaformat
Then #
- after
convert -size 8x6 xc:red source.png:- exit code is
0
- exit code is
- after
convert 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 convert -version succeeds
When #
convert -size 37x11 xc:gray sized.png
identify -format "%wx%h %m" sized.png
Then #
- after
convert -size 37x11 xc:gray sized.png:- exit code is
0
- exit code is
- after
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 convert -version succeeds
When #
identify absent.png
Then #
- exit code is
1 - stdout is empty
- stderr contains
absent.png