CRUNCHJPGS(1)

πŸ“¦ version 1.60, in nixos 26.05, nixpkgs unstable

πŸ’… crunchjpgs.pl β€” like, the whole manual, bestie ✨

okay so this is crunchjpgs.pl from the User Contributed Perl Documentation section, and it's genuinely one of my fave little tools. it squeezes all your JPG images inside a PDF so the file stops being a whole problem. let's get into it 🫢


🌸 NAME 🌸

crunchjpgs.pl β€” compress all JPG images in a PDF</p> πŸ’–

like, that's it. that's the whole vibe. all the JPGs, in a PDF, made smaller. slay.


✨ SYNOPSIS ✨

crunchjpgs.pl [options] infile.pdf [outfile.pdf]

Options:
  -j --justjpgs       make script skip non-JPGs
  -q --quality        select JPG output quality (default 50)
  -s --scale=num      select a rescaling factor for the JPGs (default 100%)
  -m --scalemin=size  don't scale JPGs smaller than this pixel size (width or height)
  -O --only=imnum     only change the specified images (can be used mutliple times)
  -S --skip=imnum     don't change the specified images (can be used mutliple times)
  -o --order          preserve the internal PDF ordering for output
     --veryverbose    increases the verbosity
  -v --verbose        print diagnostic messages
  -h --help           verbose help message
  -V --version        print CAM::PDF version

so you give it an infile.pdf, and if you want you can also hand it an outfile.pdf for where the good stuff goes. and yes, that typo up there in --only and --skip β€” "mutliple" β€” is literally in the original, i'm not fixing it, it's part of the lore now πŸ™ˆ

πŸŽ€ the values for --scale πŸŽ€

these are the only numbers --scale will accept, no cap:

    1  100%
    2   50%
    4   25%
    8   12.5%

so it's like a halving ladder. 1 is full size, 8 is itty bitty. πŸ’…

πŸ¦‹ about imnum πŸ¦‹

imnum is a comma-separated list of integers indicating the images in order that they appear in the PDF. and how do you find out those numbers? run listimages.pl, it'll tell you. iykyk πŸ’–


πŸ”₯ DESCRIPTION πŸ”₯

first things first, the vibe check: this script requires the ImageMagick convert program to be available, so make sure that's on your system or it's not gonna have a good time 😭

what it does is tweak all of the JPG images embedded in a PDF to reduce their size. and the reduction can come from two places β€” cranking up the compression, and/or rescaling the whole image. and the options give you full control over which images get altered, so you're never stuck doing a blanket edit you didn't ask for. iconic behaviour, honestly πŸ‘‘

ngl, it's a "tweak" script β€” the whole point is making the embedded JPGs smaller, and both the compression and the rescale knobs are how you get there 🌸

⭐ SEE ALSO ⭐

go look at these when you're done here, they're all in the same little family:

  • CAM::PDF
  • listimages.pl
  • extractallimages.pl
  • extractjpgs.pl
  • uninlinepdfimages.pl

πŸ‘‘ AUTHOR πŸ‘‘

see CAM::PDF. that's it, that's the author section. go check the CAM::PDF docs 🌈


and that's the whole page, bestie πŸŽ€ ~ fin ~ β€” this little beauty comes to you from perl v5.42.3, dated 2013-08-15, so yeah, it's vintage but it still eats πŸ’–βœ¨πŸ’…

πŸ“¦ where this page comes from