{"id":1363,"date":"2024-11-21T09:28:00","date_gmt":"2024-11-21T09:28:00","guid":{"rendered":"https:\/\/www.labiol.xyz\/?p=1363"},"modified":"2025-05-10T20:52:25","modified_gmt":"2025-05-10T20:52:25","slug":"convert-pdf-file-to-jpeg-with-imagemagic","status":"publish","type":"post","link":"https:\/\/www.labiol.xyz\/index.php\/2024\/11\/21\/convert-pdf-file-to-jpeg-with-imagemagic\/","title":{"rendered":"Convert pdf file to jpeg &#8211; with imagemagic"},"content":{"rendered":"\n<p>Short article just to write down not-so frequently (for me) task:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>for MacOS, install imagemagic: <code>brew install imagemagick<\/code>, when using other OS just install imagemagic with your package manager<\/li>\n\n\n\n<li>Create directory and copy\/move file you want to convert<\/li>\n\n\n\n<li>change directory to the new one <\/li>\n\n\n\n<li>Run command (macOS): <br><\/li>\n<\/ul>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\/opt\/homebrew\/bin\/magick convert -density 300 fileToConvert.pdf -quality 100 &#39;fileToConvert_%03d.jpg&#39;<\/code><\/pre><\/div>\n\n\n\n<p>remove \/opt\/homebrew\/bin from that command where using on other system than macOs<\/p>\n\n\n\n<p>Options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>density &#8212; resolution (300 dpi for high-quality images)<\/li>\n\n\n\n<li>quality 100 &#8212; set the jpeg quality, where 100 means 100% (no size reduction)<\/li>\n\n\n\n<li>fileToConvert_%03d.jpg &#8212; output file will be numbered, starting at 001<\/li>\n<\/ul>\n\n\n\n<p>other possible parameters (output file will be more optimised):<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>\/opt\/homebrew\/bin\/magick convert -density 100 file.pdf \\\n-resize 1024x1024 \\\n-quality 85 \\\n-sampling-factor 4:2:0 \\\n-strip \\\n-interlace JPEG \\\n&#39;1 fileToConvert_%03d.jpg&#39;\n<\/code><\/pre><\/div>\n\n\n\n<p>cheers <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Short article just to write down not-so frequently (for me) task: remove \/opt\/homebrew\/bin from that command where using on other system than macOs Options: other possible parameters (output file will be more optimised): cheers<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,1],"tags":[41,8],"class_list":["post-1363","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-linux","category-uncategorized","tag-convert","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=1363"}],"version-history":[{"count":6,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1363\/revisions"}],"predecessor-version":[{"id":1510,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1363\/revisions\/1510"}],"wp:attachment":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=1363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=1363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=1363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}