disintegration / imaging

Imaging is a simple image processing package for Go
MIT License
5.3k stars 443 forks source link

add DecodeWithFormat function #74

Closed labkode closed 6 years ago

labkode commented 6 years ago

The standard go image library provides the format return value when calling Decode. The imaging library provided the FormatFromFilename to get the format of the image (needed for encoding into desired image format). Given that for performing image manipulations the image has to be loaded in memory, the format comes for free when calling img.Decode.

I did not modify the imaging.Decode functions to not break existing users of this library.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 89923699af688e948a0eb884884e075a46be7df1 on labkode:decode-with-format-return into 5e63c9a565d0a3260d23d060a795783dab90fefe on disintegration:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 89923699af688e948a0eb884884e075a46be7df1 on labkode:decode-with-format-return into 5e63c9a565d0a3260d23d060a795783dab90fefe on disintegration:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 89923699af688e948a0eb884884e075a46be7df1 on labkode:decode-with-format-return into 5e63c9a565d0a3260d23d060a795783dab90fefe on disintegration:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 89923699af688e948a0eb884884e075a46be7df1 on labkode:decode-with-format-return into 5e63c9a565d0a3260d23d060a795783dab90fefe on disintegration:master.

disintegration commented 6 years ago

This function doesn't add anything to image.Decode. Imaging is not supposed to be a replacement for the standard image package. I think it's better to use image.Decode directly in this case.

As for the current version of imaging.Decode, I've added it for symmetry with imaging.Encode and at the time, it also converted image to NRGBA format after decoding. I've removed the conversion later, but the function itself is left for backward compatibility.