Skip to content

VipsForeignSave: jfif is not a known file format #3775

@casperbrike

Description

@casperbrike

Bug report

Describe the bug
I'm using ruby-vips Ruby gem and trying to save an image in JFIF file format, however, it gives me VipsForeignSave error:

img = Vips::Image.new_from_file 'img.jfif'
img.write_to_file 'new-img.jfif' # leads to VipsForeignSave: "new-img.jfif" is not a known file format (Vips::Error)

I debugged this issue a bit and found out that write_to_file calls vips_foreign_find_save function from libvips and vips_foreign_find_save raises VipsForeignSave error for JFIF file format.

Interestingly that libvips does support JFIF format, for example, we can convert JPG image to JFIF and vice versa:

vips jpegsave img.jfif converted.jpg
vips jpegsave converted.jpg converted.jfif

However, if you try to resize a JFIF image then you'll get the same VipsForeignSave error:

vips resize img.jfif resized.jfif 0.5

To Reproduce
Steps to reproduce the behavior:

  1. Use Image (GH doesn't allow uploading JFIF files so just remove .txt from filename after you download the image): sun.jfif.txt
  2. Run vips resize sun.jfif resized.jfif 0.5
  3. See VipsForeignSave error

Environment

  • OS: MacOS 13.2
  • Vips: 8.15

Additional details
I'm not really proficient at C but, probably, a solution would be to add .jfif here?

const char *vips__jpeg_suffs[] = { ".jpg", ".jpeg", ".jpe", NULL };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions