imagemagick-convert

Trying to run same command in command prompt not working

大兔子大兔子 提交于 2019-12-23 15:38:38
问题 I am making a program that seeks out secured PDFs in a folder and converting them to PNG files using ImageMagick. Below is my code. string WorkDir = @"C:\Users\rwong\Desktop\TestFiles"; Directory.SetCurrentDirectory(WorkDir); String[] SubWorkDir = Directory.GetDirectories(WorkDir); foreach (string subdir in SubWorkDir) { string[] filelist = Directory.GetFiles(subdir); for(int f = 0; f < filelist.Length; f++) { if (filelist[f].ToLower().EndsWith(".pdf") || filelist[f].EndsWith(".PDF")) {

Ubuntu covert all images in a folder

二次信任 提交于 2019-12-23 04:58:12
问题 I am using a script for converting all the images in my folder to flop operation. The script is like this: for f in *.jpg; do new="${f%%.jpg}_flop.jpg"; convert "$f" -flop -quality 100 "$new"; done Now I have found that there may be also images with the extension .JPG I thought of adding a new for loop that looks like this: for f in *.JPG; do new="${f%%.jpg}_flop.jpg"; convert "$f" -flop -quality 100 "$new"; done I think that there is a syntax for ignoring the case, and this way I can do a

How to use Fred's ImageMagick textcleaner script?

馋奶兔 提交于 2019-12-23 03:02:12
问题 I want to do OCR on some of my images, but images are not quite very impressive. So, for cleaning it I wanted to use Fred's ImageMagick Textcleaner script. Command that I gave:- sh textcleaner.sh input_file output_file -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 This is the arguments which Fred has given on website itself. I am also doing for same sample image. But I don't think so any of my options are working everything is by default. And I keep getting this error also textcleaner.sh:

ImageMagick memory usage

家住魔仙堡 提交于 2019-12-22 06:41:01
问题 I have 100 PNG-files and each of them is 8250x4090 big. I need to append them with Imagemagick to one big PNG-file (82500 x 40900) so that I have 10 rows and 10 columns . I know how the code must look like but I get the errors: convert.exe: unable to extend cache `C:\Row_345.png': No space left on device @ error/cache.c/OpenPixelCache/3689. convert.exe: Memory allocation failed `C:\Row_345.png' @ error/png.c/WriteOnePNGImage/8725. First question: How much space is needed (approximately)? I

Resize to fit in a box and set background to black on “empty” part

可紊 提交于 2019-12-22 03:43:19
问题 I'm trying to obtain this result: fixed box size (133x100), the image should be resized but not stretched to fit inside that box, the empty space should be filled with black. I'm actually trying with this command: convert -background black -gravity center -extent 133x100 from.jpg to.jpg However instead of fitting the image inside the requested box, I obtain a crop of the image. How to obtain the requested result? I'm digging into documentation but there are a lot of options and I still didn't

How do I convert a base64 image?

本秂侑毒 提交于 2019-12-22 03:24:32
问题 I am trying to use the "convert" command-line tool from ImageMagick. I have a base64 encoded png file and I need to convert it to another format. I am looking at documentation and a forum discussion which suggests that I should be able to use this syntax: convert inline:file.txt file.jpg But when I do this, I get this error message: convert: corrupt image `file.txt' @ error/constitute.c/ReadInlineImage/910. What am I doing wrong? How do I get convert to read a base64 image file? 回答1: Updated

Imagemagick skew image with 4 (x,y) coordinates

一个人想着一个人 提交于 2019-12-21 23:09:14
问题 I have 4 (x,y) coordinates between which I want place image as example given below. The whole image must be placed within this area without cropping. 回答1: Using this 800x600 balloon: You can use a "Perspective Distort" like this: convert balloon.jpg -matte -virtual-pixel transparent \ -distort Perspective '0,0,50,0 0,599,100,599 800,0,750,100 800,600,500,500' result.png There are basically 4 pairs of points in the parameters,i.e. Pt1X,Pt1Y,Pt1NewX,Pt1NewY Pt2X,Pt2Y,Pt2NewX,Pt2NewY Pt3X,Pt3Y

Crop circular image with dragonfly rails

你说的曾经没有我的故事 提交于 2019-12-21 21:38:04
问题 I'm using dragonfly ~> 0.9.15 Given an image, I'm confused at how to use the convert method in dragonfly to crop a circular portion from the image with transparent background. I am able to use a direct image magick command to run it from command line but the example command I found uses actual files and I'm unaware of how to get the file while dragonfly processes it on the fly. Here's the actual command I took from a stack overflow question with imagemagick. https://stackoverflow.com/a/999563

Replace only background color of PNG

别说谁变了你拦得住时间么 提交于 2019-12-20 03:13:45
问题 Here is my code: #! /usr/bin/env sh # Generate test image. convert -size 100x60 xc:blue -fill blue -stroke black -draw "circle 50,30 55,55" in.png # Make background transparent. convert in.png -fill none -draw 'matte 0,0 floodfill' -flop -draw 'matte 0,0 floodfill' -flop out.png # Replace transparent background with green. mogrify -background green -flatten out.png # The wrong way. convert in.png -transparent blue oops.png mogrify -background green -flatten oops.png It is based on this

Fastest way to create multiple thumbnails from a single large image in Python

微笑、不失礼 提交于 2019-12-19 04:01:39
问题 I have a library of large images (8000x6000px ~13mb) for which I would like to generate multiple thumbnails of smaller sizes with widths of 3000px, 2000px, 1000px, 500px, 250px, and 100px. The source image is stored in a flat file, and the generated thumbnails will also be stored in flat files. I've been thinking about the optimal way to do this in Python, and these are potential issues that immediately come to mind: Would it make sense to generate each thumbnail from source image, or can I