Source code

Revision control

Copy as Markdown

Other Tools

# Encoder ref tests
# These reftests must be run as HTTP because of canvas' origin-clean security
# file:// URLs are always considered from a different origin unless same URL
#
# The test will copy a PNG image to a canvas, then use canvas.toDataUrl to get
# the data, then set the data to a new image hence invoking the appropriate
# encoder.
#
# The tests should only be used with lossless encoders.
#
# Valid arguments for encoder.html in the query string:
# - img=<reference image to use>
# - mime=<mime type>
# - options=<canvas toDataURL encoder options>
# Example:
# encoder.html?img=escape(reference_image.png)
# &mime=escape(image/vnd.microsoft.icon)
# &options=escape(-moz-parse-options:bpp=24;format=png)
# PNG
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/png
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/png
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/png
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/png
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/png
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/png
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/png
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/png
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/png
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/png
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/png
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/png
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/png
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/png
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/png
# BMP using default parse options
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/bmp
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/bmp
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/bmp
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/bmp
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/bmp
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/bmp
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/bmp
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/bmp
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/bmp
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/bmp
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/bmp
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/bmp
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/bmp
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/bmp
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/bmp
# BMP using image/bmp mime type and 32bpp parse options
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D32
# BMP using image/bmp mime type and 24bpp parse options
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/bmp&options=-moz-parse-options%3Abpp%3D24
# ICO using default parse options
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/vnd.microsoft.icon
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/vnd.microsoft.icon
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/vnd.microsoft.icon
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/vnd.microsoft.icon
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/vnd.microsoft.icon
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/vnd.microsoft.icon
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/vnd.microsoft.icon
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/vnd.microsoft.icon
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/vnd.microsoft.icon
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/vnd.microsoft.icon
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/vnd.microsoft.icon
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/vnd.microsoft.icon
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/vnd.microsoft.icon
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/vnd.microsoft.icon
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/vnd.microsoft.icon
HTTP == size-256x256.png encoder.html?img=size-256x256.png&mime=image/vnd.microsoft.icon
# ICO using image/vnd.microsoft.icon mime type and 32bpp parse options with bmp
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
HTTP == size-256x256.png encoder.html?img=size-256x256.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D32%3Bformat%3Dbmp
# ICO using image/vnd.microsoft.icon mime type and 24bpp parse options with bmp
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
HTTP == size-256x256.png encoder.html?img=size-256x256.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Abpp%3D24%3Bformat%3Dbmp
# ICO using image/vnd.microsoft.icon mime type png
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
HTTP == size-256x256.png encoder.html?img=size-256x256.png&mime=image/vnd.microsoft.icon&options=-moz-parse-options%3Aformat%3Dpng
# WEBP
HTTP == size-1x1.png encoder.html?img=size-1x1.png&mime=image/webp&options=1
HTTP == size-2x2.png encoder.html?img=size-2x2.png&mime=image/webp&options=1
HTTP == size-3x3.png encoder.html?img=size-3x3.png&mime=image/webp&options=1
HTTP == size-4x4.png encoder.html?img=size-4x4.png&mime=image/webp&options=1
HTTP == size-5x5.png encoder.html?img=size-5x5.png&mime=image/webp&options=1
HTTP == size-6x6.png encoder.html?img=size-6x6.png&mime=image/webp&options=1
HTTP == size-7x7.png encoder.html?img=size-7x7.png&mime=image/webp&options=1
HTTP == size-8x8.png encoder.html?img=size-8x8.png&mime=image/webp&options=1
HTTP == size-9x9.png encoder.html?img=size-9x9.png&mime=image/webp&options=1
HTTP == size-15x15.png encoder.html?img=size-15x15.png&mime=image/webp&options=1
HTTP == size-16x16.png encoder.html?img=size-16x16.png&mime=image/webp&options=1
HTTP == size-17x17.png encoder.html?img=size-17x17.png&mime=image/webp&options=1
HTTP == size-31x31.png encoder.html?img=size-31x31.png&mime=image/webp&options=1
HTTP == size-32x32.png encoder.html?img=size-32x32.png&mime=image/webp&options=1
HTTP == size-33x33.png encoder.html?img=size-33x33.png&mime=image/webp&options=1