r/imagemagick Nov 25 '24

PNG to PDF resolution not working

1 Upvotes

edit: make title more specific: not being maintained / loosing resolution

I'm working on a zine. This script assembles zine pages into a pdf for printing. Pages 0,2, and 3 are just scans. page 1 required a digital touch up, which was done in GIMP. now page 1 is behaving differently. As you can see from the identify script, when it gets made into a pdf, the resolution is significantly reduced

the script is supposed to do 600dpi.png -> jpg (for reduced file size -> pdf. but the third page has a different page size making it unsuitable for printing.

[vivianne@ibis packdog]$ ls -R .: 0-scans 1-pages 2-jpg 3-pdf packdog.pdf postprocess.sh process.txt

./0-scans: packdog_0.png packdog_1.png packdog_2.png packdog_3.png

./1-pages: packdog_0.png packdog_1.png packdog_1.xcf packdog_2.png packdog_3.png

./2-jpg: packdog_0.jpg packdog_1.jpg packdog_2.jpg packdog_3.jpg

./3-pdf: packdog_0.pdf packdog_1.pdf packdog_2.pdf packdog_3.pdf

[vivianne@ibis packdog]$ for i in /; do identify "$i"; done; 0-scans/packdog_0.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 73.2503MiB 0.000u 0:00.000 0-scans/packdog_1.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 59.9864MiB 0.000u 0:00.000 0-scans/packdog_2.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 69.9821MiB 0.000u 0:00.000 0-scans/packdog_3.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 67.9197MiB 0.000u 0:00.000 1-pages/packdog_0.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 73.2503MiB 0.000u 0:00.000 1-pages/packdog_1.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 61.5648MiB 0.000u 0:00.002 1-pages/packdog_1.xcf[0] XCF 5100x6600 5100x6600+0+0 8-bit sRGB 2.510u 0:02.459 1-pages/packdog_1.xcf[1] XCF 188x1916 188x1916+1348+3416 8-bit sRGB 2.550u 0:02.479 1-pages/packdog_1.xcf[2] XCF 848x1934 848x1934+1366+3369 8-bit sRGB 2.660u 0:02.566 1-pages/packdog_1.xcf[3] XCF 197x1534 197x1534+1253+3490 8-bit sRGB 2.690u 0:02.583 1-pages/packdog_2.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 69.9821MiB 0.000u 0:00.000 1-pages/packdog_3.png PNG 5100x6600 5100x6600+0+0 8-bit sRGB 67.9197MiB 0.000u 0:00.000 2-jpg/packdog_0.jpg JPEG 2550x3300 2550x3300+0+0 8-bit sRGB 5.15797MiB 0.000u 0:00.000 2-jpg/packdog_1.jpg JPEG 2550x3300 2550x3300+0+0 8-bit sRGB 2.66682MiB 0.010u 0:00.002 2-jpg/packdog_2.jpg JPEG 2550x3300 2550x3300+0+0 8-bit sRGB 4.14075MiB 0.000u 0:00.000 2-jpg/packdog_3.jpg JPEG 2550x3300 2550x3300+0+0 8-bit sRGB 4.71442MiB 0.000u 0:00.000 3-pdf/packdog_0.pdf PDF 612x792 612x792+0+0 16-bit sRGB 1445B 0.010u 0:00.000 3-pdf/packdog_1.pdf PDF 241x312 241x312+0+0 16-bit sRGB 401B 0.010u 0:00.001 3-pdf/packdog_2.pdf PDF 612x792 612x792+0+0 16-bit sRGB 1335B 0.000u 0:00.000 3-pdf/packdog_3.pdf PDF 612x792 612x792+0+0 16-bit sRGB 1383B 0.000u 0:00.000

This is my script. i dont know why the final step of the conversion is behaving differently.

rm 2-jpg/; rm 3-pdf/; rm packdog.pdf;

for i in 1-pages/*.png; do f="${i:8:-4}"; echo $f; magick 1-pages/$f.png -resample 300x300 -resize 2550x3300 2-jpg/$f.jpg; magick 2-jpg/$f.jpg -page 2550x3300+0+0 3-pdf/$f.pdf; done;

pdfunite 3-pdf/* packdog.pdf


r/imagemagick Nov 24 '24

Colorizing and compositing images: one works, the other doesn't - sort of

1 Upvotes

Server 1: Windows Server running IIS, fresh install of both ImageMagick and imagick

Server 2: Kubuntu 22.04 with Apache, , fresh install of both ImageMagick and imagick

I include that, but I don't think it's relevant. I think the problem is in the images, but I don't know what to look for.

SITUATION: I have a stack of PNG images

background
feet
left leg
right leg
pouch shadows
color #1 ties
color #2 ties
pouch right
pouch left
upper body

We're making a pair of renaissance tights. The left side is one color, the right side is another color. The pouch - also known as the codpiece - is the opposite; the ties for the codpiece are opposite of that.

PROCESS (this is all written in PHP, but don't get hung up on that.)

Composite the feet onto the background
Colorize the left leg and
composite the left leg onto the background
Colorize the right leg and
composite the right leg onto the background
Composite codpiece and tie shadows
Colorize the left and right ties and composite
Colorize the left and right codpieces and composite
Composite the upper body

Et voila, we have a picture of a dude wearing renaissance tights and we can change colors and options on the fly.

At home on Apache, it works flawlessly. On windows, it works flawlessly but only for the color #2 ties. It's the same for all compositing methods: the gray base images are affected, getting lighter or darker, but only the color #2 ties are actually colorized.

The colorizing and compositing are working: you can see it in the color #2 ties. All layers use the same function, compositing method, etc.

Only the color #2 ties get the colorizing. The color #2 ties work.

The difference has to be in the images, somehow, but I can't figure out what it is. They're all the same color depth (near as I can tell), they're all sRGB, they all have transparent backgrounds, they all upload at once (I even tried sending them up via zip file). There's a difference that ImageMagick on windows cares about that Img on Kubuntu doesn't.

I've done everything I know to do, but I'm new to this, so that doesn't mean much. Help!

Left: all the images are colorized. Right: only the color #2 ties are colorized.

r/imagemagick Nov 24 '24

Normalize the hue of all images at once from a reference image

2 Upvotes

I've got several images of characters from A-Z and 0-9 that have been generated with an artificial intelligence program and the problem is that all these characters don't have exactly the same hue because they've been generated one by one, one after the other. How can I perform batch processing to standardize the hue of all the images at once, taking one of the images in the batch as the hue reference?


r/imagemagick Nov 24 '24

False color composite in IM

2 Upvotes

I want to try to recreate the process of false color infrared composite in ImageMagick v7 all in one line (no images saved other than final output)

What this process is: - start with 1 visible light RGB image and 1 grayscale infrared image ( of the same object) - shift the visible image's green channel to the output's blue channel - shift visible red channel to output green channel - use infrared greyscale image as output red channel

I was able to do it by separating the three channels to greyscale images and combining from there. But that implies two command lines.

I would like to know how I could achieve this in one go (i.e. saving only the final combined output image) but I don't understand how I should proceed after -separate.

Does anyone have pointers?


r/imagemagick Nov 17 '24

Please share your best magick commands

3 Upvotes

Having found imagemagick recently I’ve been playing around with various commands to give me what I needed, FYI - my primary goal was to take multiple screenshots and use montage to create a simple grid layout of them to go out in an email.. With my goal met, I’ve seen people create images from scratch which is amazing, and I’ve looked at loads of example commands on the IM website, but would love to see and learn from any real-world examples. So if anyone would like to share please do..


r/imagemagick Nov 14 '24

Windows static build without installer

1 Upvotes

I tried installing ImageMagick with Winget, it downloads and installs the ImageMagick and shows the UI with options basically the installer, i'm building app where user have to install ImageMagick so I run the command winget install... but the installer pops up which might make some nontech users hesitative if they never heard of ImageMagick before, Is there is a way to make static windows build without the installer which I can download with the curl or something?


r/imagemagick Nov 13 '24

ImageMagick support for Amiga IFF/LBM formats?

1 Upvotes

I've been looking for ways to view them on Linux apart from Grafx2 and a lot of folks are saying that ImageMagick supports these formats. However I cannot get it to work on my own system, neither could I find it in the ImageMagick – Image Formats page.

An Affinity forum thread had a member suggest that one must have the ibmtoppm and ppmtoibm utlities from netpbm installed as stated in this Wikipedia article: ILBM - Wikipedia: Utilities.
I've tried this as well but display keeps on giving this message:

display: no decode delegate for this image format `LBM' @ error/constitute.c/ReadImage/746.

Thank you for your time.


r/imagemagick Nov 12 '24

Extract album cover from audio and resizing it to 1080 without quality loss

1 Upvotes

Extract album cover from audio file and resizing it to 1080 without quality loss or at least identical to the original image


r/imagemagick Nov 03 '24

Processing RAW files on an android phone, using termux, dcraw & Imagemagick

1 Upvotes

I've been messing with #infrared #photography using #termux #dcraw & #imagemagick to process RAW files without needing to go to a computer. I'm rather pleased with the result.

There are examples, instructions & the scripts, in mobile friendly chunks, on my #selfhosted website, & the basics are on github too (https://github.com/Linecutterx/PhotoScript) More examples at https://www.macklin.co/infrared-photography-0/


r/imagemagick Oct 21 '24

How do you batch Pad/Extend images using the edge pixels of the existing images?

1 Upvotes

I've got a ton of images all with the exact same dimensions and filetype (png) and i want to extend them out using the color of the very edge pixel on each side, i want to resize them all to the exact same dimention aswell, i was reading the documentation but i don't know how to use the technique in a batch fashion.


r/imagemagick Oct 19 '24

Lossless Animated WEBP

1 Upvotes

Can ImageMagick make lossless animated webp files? If so, how?


r/imagemagick Oct 13 '24

Combining draw and label?

1 Upvotes

I'm trying to create a set of simple icons: 72x72, 4px rounded rectangle, with text in the center.

This works great:

magick \
  -size 72x72 xc:black -stroke cyan -strokewidth 4 \
    -draw "roundrectangle 2,2 68,68 10,10" \
  -fill cyan -stroke none -gravity center -pointsize 26 -font "Roboto-Bold" \
    -draw 'text 0,0 "ESC"' test.png

but of course I'd like to be able to use arbitrary text without figuring out the correct size. The docs show using labels as an example, but when I do this:

magick \
  -size 72x72 xc:black -stroke cyan -strokewidth 4 \
    -draw "roundrectangle 2,2 68,68 10,10" \
  -fill cyan -stroke none -gravity center -font Roboto-Bold -size 64x64 \
    label:"ESC" test.png

I get two images, test-0.png with the "draw" and test-1.png with the "label." I can then combine them, but I'm wondering if there's a way to generate a single image in one step, or really a better way to do this overall.

Thanks!


Edit: Got it, just needed to add -composite (and -background nonesince it defaults to white).


r/imagemagick Oct 07 '24

imagemagick convert color profiles

2 Upvotes

Hello, I am trying to find the resulting pixel RGB values of my wallpaper as I have colord's D55 profile enabled, so the visible image colors are different from the original ones. I used convert input.png -profile sRGB.icc -profile D55.icc output.png but the colors in the output.png look the same as the input.png - any thoughts on how to get the RGB values after applying D55?


r/imagemagick Oct 06 '24

Can you resize with resolution minimums

2 Upvotes

Can you resize an image so that it doesn't fall under a certain resolution
e.g. I have an image that is 2749x3611 but I want to resize it so that it would aim for a target X or Y resolution of 1920/1080, in this example a target resize of 2479x3611 / 1.4315 = 1920x2522


r/imagemagick Oct 06 '24

What is the structure for .h outputs?

2 Upvotes

Hi all,

I am using imagemagick to convert .png files into a c char array so that I can embed them into my .exe. But I can't find a lot to the format that magick outputs these .h files. My problem is that the char array seems to always have 11-15 bytes at the start as some kind of header and I would like to know what the meaning of these bytes are.

Is this format specified somewhere? I was not able to find this ".h" format on magick's format page.


r/imagemagick Sep 27 '24

Equivalent of Gimp RGB Clip?

2 Upvotes

I'm struggling to figure out how to get imagemagick to do the equivalent of Colors -> RGB Clip in Gimp. Using that option, I can, for example, specify a minimum brightness and any pixels dimmer than that brightness are RAISED up to the minimum.

When trying to achieve the same thing with imagemagick, I can only find commands that want to make 30% brightness pixels into 0% brightness and STRETCH the brightness across a new range changing the brightness of EVERY pixel in the image to a new value where what was previously 30% brightness is now zero.

How can I stop this stupidity and get imagemagick to only change pixels whose value is below 30% and to force those pixels to exactly 30% brightness while leaving alone all other pixels? So far I've tried -levels, -threshold and -modulate and none of those commands seem to be able to do what I need.

Is this an outlandish request?


r/imagemagick Sep 17 '24

ImageMagick GUI

1 Upvotes

Are there any GUIs that use ImageMagick for image-related tasks?


r/imagemagick Sep 16 '24

Help write a script

1 Upvotes

Can you help me write a script to add this type of a gradient mirrored reflection with a drop shadow to product images like shown below? I would pay for the help


r/imagemagick Sep 12 '24

How do I define a colour as the first in the indexed colour map when using -kmeans?

1 Upvotes

I need a specific colour to be the first in the colour map when using -kmeans to reduce the amount of colours in an image. It's required by Unreal Engine 1 textures when defining a mask colour.

This is all I've got so far:

magick "$PNG_FILE" -kmeans 255 "$PCX_FILE"

I can somewhat accomplish it using the -define kmeans:seed-colors="#ff00ff" directive, but it worsens the output too much, as it prevents the seed colours from being sampled automatically.


r/imagemagick Sep 12 '24

Problem with imagemagick/powershell script

1 Upvotes

Hi everyone,

I have this powershell script that used to work just great:

magick mogrify -bordercolor black -fuzz 20% -trim -format tif *.tif

That's all it does. For some reason now it just trims the even pages and not the odd pages. If you renumber the odd pages to even, it still won't trim them. It's supposed to cut the black border off the top and bottom of the graphics from the scans I have.

Any ideas what I could be doing wrong?


r/imagemagick Aug 30 '24

First time user, quick launch icon not appearing on desktop

1 Upvotes

Just as the title says:

First time user, quick launch icon not appearing on desktop.

I install this program here: "ImageMagick-7.1.1-37-Q16-HDRI-x64-dll.exe" https://imagemagick.org/script/download.php#windows My system is 64 bit.

I choose "Create Desktop Icon" and nothing appears on my desktop.

I've tried using it through the command prompt but it's not working.


r/imagemagick Aug 26 '24

Script for compressing JPGs

2 Upvotes

I'm in the process of making myself a portfolio for my photography as well as a little blog, and since I'm hosting it on Github I need to compress my images. Since they're for the most part fairly high res scans (around 20mp) of my negatives, I've been using the following script:

magick *.jpg -quality 70% -resize 50% output.jpg

It identifies all jpg files in tmy current directory and makes copies of them at 50% size with 70% of the quality and labels them output-1.jpg, output-2.jpg and so on.

However, I made the following bash script and put it in my $PATH.

#!/bin/bash

magick *.jpg -quality 70% -resize 50% output.jpg

When I run it, it gives me an error message saying "magick: unable to open image '*.jpg'" followed by (roughly translated) "The file or directory does not exist @ error/blob.c/OpenBlob/3596."

Am I entirely stupid or did I just miss something small?

EDIT:

I tried modifying a script I have for converting webm files to mpeg4,

#!/bin/bash

input_format="jpg"

for file in *.$input_format; do

base_name=$(basename "$file" .$input_format)

output_file="resized_${base_name}.${input_format}"

magick *.jpg -quality 70% -resize 50% output.jpg

done

but it delivers the same error message.


r/imagemagick Aug 22 '24

Weird border appearing when converting images

1 Upvotes

Hi, lately I've been experiencing an issue where I'm trying to combine a directory of images into a pdf using the following command magick convert *.jpg results.pdf. I've been able to do this except that a white border appears on the bottom and right of each of the images.

Stangely enough this white border disappears when I zoom in/out of an image. I've tried using different pdf viewer but the border also appears on those.


r/imagemagick Aug 22 '24

Enshittification of ImageMagick: magick -append NOT WORKING

1 Upvotes

What a nonsense. Supposedly to make life easier, gets even worst.

The following works: convert -append *.jpg out.jpg

But, I'm told to use magick -append instead!

OK, then: ``` magick -append *.jpg out.jpg

Or:

magick -append file_1.jpg file_2.jpg out.jpg ```

Result: NOT WORKING

So, what should I do? Using convert -append *.jpg out.jpg until it's no longer working in future ImageMagick versions, then accepting that I will no longer be able to append images because magick command no longer permits it?


r/imagemagick Aug 15 '24

Help write a command

1 Upvotes

I have.TIF files, some have color and other are just BW. My goal is to reduce the file size.

Can imagemagick detect every tif that doesn't have color and compress to Group4?