fix load ico

pull/555/merge
Pete Matsyburka 1 month ago
parent 111bef14e1
commit ba2da69a67

@ -2,6 +2,7 @@
module LoadIco module LoadIco
BI_RGB = 0 BI_RGB = 0
PNG_SIGNATURE = "\x89PNG".b
module_function module_function
@ -42,6 +43,8 @@ module LoadIco
raise ArgumentError, 'Unable to load' unless image_data_bytes && image_data_bytes.bytesize == best_entry[:size] raise ArgumentError, 'Unable to load' unless image_data_bytes && image_data_bytes.bytesize == best_entry[:size]
return Vips::Image.new_from_buffer(image_data_bytes, '') if image_data_bytes.start_with?(PNG_SIGNATURE)
image = load_image_entry(image_data_bytes, best_entry[:width], best_entry[:height]) image = load_image_entry(image_data_bytes, best_entry[:width], best_entry[:height])
raise ArgumentError, 'Unable to load' unless image raise ArgumentError, 'Unable to load' unless image

Loading…
Cancel
Save