Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Density Option Support #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

softopia-tech
Copy link

density option only works when it's on second place in command (tested for pdf to image)

density option only works when it's on second place in command (tested for pdf to image)
$densityAry = [];
$densityAry[] = '-density';
$densityAry[] = (string) $density;
array_splice($this->command,2,0,$densityAry); //density option only works when it's on second place in command (tested for pdf to image)
Copy link
Member

@Pierstoval Pierstoval Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Density is not supposed to be placed "second place in command", but "before any vector source is specified".

If you use ImageMagick to manipulate multiple files or intermediary files, you should be able to specify the density for all files.

You say you "tested for pdf to image", but if you test "image to pdf", you'll realize that the density option must be put before the pdf filename, like this for instance: convert my-file.jpg -density 300 my-file.pdf.

Another case is units. By default, density is in dpi (dots per inch), but you can use the -units option to switch to dots per centimeters, but it has to be specified before the -density option. Your code proposal doesn't allow that.

Also, the density option must respect its specified format: {width} | {width}x{height}.
You can add a small function to the Reference class that will validate these rules.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to read Reference classes but didn't get so much idea how i will gonna add these options but i'll try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants