Keep original image format when using MiniMagick unless explicited #2626
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
We recently switched from
RMagick
toMiniMagick
in our codebase. This lead to an important change of behaviour in the uploader processSummary
When using minimagick, it seems like the image is always converted to jpeg when running
process resize_to_limit: ...
, thus failing to have anotherprocess
afterwards expecting an image that would still be in png format.Reproduction
Current Lead
As far as I understood the problem, it seems like the
#minimagick!
tends to change the name and format of the file. However, it is likely that this change is just a reflection of the original format change, done withinImageProcessing
(checked usingfile --mime
within#minimagick!
.ImageProcessing
is actually always converting to jpeg by default unless explicitely stated otherwise:Hence my bet is that we could actually change the way the extension is handled in
#minimagick!
:ImageProcessing
pipeline (a.k.a builder) contains a.convert(file.content_type)
TODO
I had planned to open this as an issue first. Since I am not 100% sure that the lead here suits you, I'd rather discuss it first. Discuss the fact that this is likely to be a breaking change. And only then implement what is left:
#minimagick!
method according to the changes