Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:58:11+00:00 2026-05-23T12:58:11+00:00

I have an imagemagick convert command that I use from the shell and I

  • 0

I have an imagemagick convert command that I use from the shell and I would like to create a linux exec to run it, so I don’t have to always run this.

I am converting a PDF file to JPEG files, and this is what I use:
convert -density 300 *.pdf -alpha off -scale 1500×2000 -quality 70 jpegFiles.jpg

What I would like the linux exec file to do is run the above convert and instead of jpegFiles, to have the actual PDF filename. Of course, for every page jpeg file it would have filename-0.jpg, filename-1.jpg, filename-2.jpg, etc.

I am using Ubuntu.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:58:12+00:00Added an answer on May 23, 2026 at 12:58 pm

    save this in a file and place it in a dir like $HOME/.bin
    eg. $HOME/.bin/pdf2jpg

    for file in "$@"; do
        convert -density 300 "$file" -alpha off -scale 1500x2000 -quality 70 "${file%.*}-%d.jpg"
    done
    

    make it executable

    chmod +x $HOME/.bin/pdf2jpg
    

    and add that dir to the PATH variable

    echo "PATH=$PATH:$HOME/.bin" >> $HOME/.bash_profile    # assuming you use bash
    

    create a dir named as your pdf along with -images suffix and place the files in there

    for file in "$@"; do
        dir="${file%.*}-images"
        mkdir -p "$dir"
        convert -density 300 "$file" -alpha off -scale 1500x2000 -quality 70 "$dir/${file%.*}-%d.jpg"
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to use imagemagick convert command from php. So I'm using shell_exec but
I have some websites that use ImageMagick to convert images and place them in
I don't know anything about imagemagick, I have a need to convert images that
I have a problem that I would like to merge a large number of
I'm trying to use Imagemagick convert.exe with Flex4 NativeProcess. I know I have it
I have several low quality pdfs. I would like to use OCR -- to
I don't really know that much about bash scripts OR imagemagick, but I am
I have a 1000x1000 300dpi image that I need to convert to a 100x100
I have successfully used the following command line to create a new GIF image
I'm trying to convert hundreds of images that Have an unknown subject centered in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.