Skip to content

Commit

Permalink
Fix ImageMagick command for v7 option handling
Browse files Browse the repository at this point in the history
Options specified before the input image can be interpreted as options
to generate an image.

Example:

```
convert -size 300x200 xc:lightblue image.png
```

The `-size` and `xc:lightblue` options create a new image, and
`image.png` is considered the output file. 

By moving the options **after** the input image, we ensure that the
input file is interpreted correctly and only the output is modified
according to the specified options.

This will also add compatibility to ImageMagick v7
  • Loading branch information
tagliala committed Sep 12, 2024
1 parent 3c57b28 commit 27183db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/heathen/processor_methods/convert_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ class Processor
# utility from ImageMagick. Sets the job content to the new format.
# @param to [String] the format to convert to (suffix)
# @param params [Array] optional parameters to pass to the convert program.
def convert_image to: 'tiff', params: nil
def convert_image to: 'tiff', params: ''
expect_mime_type 'image/*'

target_file = temp_file_name '', ".#{to.to_s}"
executioner.execute(
*[Colore::C_.convert_path,
params.split(/ +/),
job.content_file,
params.split(/ +/),
target_file].flatten
)
raise ConversionFailed.new if executioner.last_exit_status != 0
Expand Down

0 comments on commit 27183db

Please sign in to comment.