comparar_formatos
Compares the same image encoded in multiple formats at matching perceived quality, identifies the lightest file, and optionally saves the winner or all versions as new files.
Instructions
Encodes the same image in several formats at the same perceived quality (SSIMULACRA 2 score, 80 by default) and says which one is the lightest. Saves the best one (by default), all or none, always as new files. It takes a while: about 7 trials per format (with a 12 MP photo, over a minute; with 24 MP, about three). With photos over about 20 MP, better use empezar_lote with that image, the formats and mas_ligero: it does the same in the background and isn't cut off by a timeout, although it only gives the winner. For a single output already decided, optimizar_imagen. Example: {"ruta": "~/a.png", "formatos": ["webp", "avif", "jxl"]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alto | No | Maximum height, in pixels: scales down if larger and never enlarges (with ancho alone, proportional). | |
| ruta | Yes | Absolute path of the image (~ is accepted). | |
| ancho | No | Maximum width, in pixels: scales down if larger and never enlarges (with alto alone, proportional). | |
| paleta | No | Reduce the palette to this number of colors (2 to 256), with dithering. | |
| salida | No | Folder to save to. By default, next to the original. | |
| guardar | No | What to save: mejor (the best one, by default), todos (all) or ninguno (none). | |
| recorte | No | Crop to this rectangle, before resizing (in pixels of the already auto-rotated image; whatever goes past the edge is trimmed). | |
| formatos | No | The formats to compare. By default, webp, avif and jpeg. | |
| enderezar | No | Auto-rotate according to the EXIF orientation if the photo needs it. Yes by default. | |
| lado_mayor | No | Maximum longest side, in pixels: the width if landscape, the height if portrait; never enlarges. Not together with ancho, alto or porcentaje. | |
| porcentaje | No | Reduce to this percentage (50 = half the width and height). From above 0 to 100. Not together with ancho, alto or lado_mayor. | |
| nota_objetivo | No | The SSIMULACRA 2 score they all have to reach. 80 by default. |