ImageMagick

Upload with paperclip very slow (unicorn)

强颜欢笑 提交于 2019-12-22 08:57:30
问题 Sitting here with a simple rails 3 app in which I have a simple Gallery model and each gallery has many images. The image model is extended with paperclip and with the following options has_attached_file :local, :styles => { :large => "800x800>", :medium => "300x300>", :thumb => "100x100#", :small => "60x60#" } In my galleries_controller I have the following action that is implemented in order to work with the jQuery-File-Upload plugin. thereby the json response. def add_image gallery =

How to search an image for subimages using linux console?

◇◆丶佛笑我妖孽 提交于 2019-12-22 08:47:16
问题 I have to search for the occurrence of a smaller image in a larger one using the console. As result I want to receive it`s image coordinates. What solutions are possible? I heard about ImageMagick, but not really understand how it works. If it`s enough, then I would appreciate an example command. Thank you. 回答1: Here's a little example so you can see how it works... First, our needle image Now make a haystack, green and blue - very stylish :-) convert -size 256x256 gradient:lime-blue haystack

ImageMagick Convert PDF to low resolution JPG file

你。 提交于 2019-12-22 08:19:48
问题 I have been trying to convert PDF to JPG images using ImageMagick on CodeIgniter, but the produced image is in low quality and always having black background for some reason (while PDF isn't). The code I'm using public function converter($pdf){ $this->load->library('image_lib'); $config = array( 'image_library' => 'imagemagick', 'library_path' => '/usr/bin/convert', 'source_image' => "./pdf/".$pdf, 'new_image' => "./images/a.jpg", 'maintain_ratio' => true, 'width' => 980, 'quality' => '90%',

How can I image_read multiple images at once?

[亡魂溺海] 提交于 2019-12-22 08:13:36
问题 In order to create a .gif using the magick package, how could I read multiple images at once? I'm importing them succesfully in a list object, but getting an error from image_animate() . # read all files in folder (only .png files) capturas <- list.files("./path/to/images/") # get all images in a list images <- vector() for (i in seq_along(capturas)) { images[i] <- list(image_read(str_c("./path/to/images/", capturas[i])))} image_animate(image_scale(images, "500x500"), fps = 1, dispose =

How to decode base64 image file with mini_magick in Rails?

我们两清 提交于 2019-12-22 08:03:50
问题 In our Rails 4 app, the image is uploaded to server in a base64 string: uploaded_io = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2....." We would like to to retrieve the content type, size and so on and save the file as image file on file system. There is a gem 'mini_magick' in our app. Is there a way to process base64 image string with mini_magick ? 回答1: Yes, there is a way to do that. Strip metadata "data:image/jpeg;base64," from your input string and then decode it with Base64

Image magick overlaying images

吃可爱长大的小学妹 提交于 2019-12-22 06:47:58
问题 I have two images, one is the overlay, lets say Image A with transparency, and another image B, I have to place the overlay image A over image B, so that some part of image B is visible through the transparent part of image A, I also have to move the image B according to some parameters, How can I achieve this with image magick 回答1: I was able to achieve it by the following command composite -compose Dst_Over -geometry 520x320+20+80 image.jpeg overlay.png final.png the key here -compose Dst

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

ImageMagick Reflection

走远了吗. 提交于 2019-12-22 05:59:15
问题 Brief: convert ( -size 585x128 gradient: ) NewImage.png How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command. Details: I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do here but the solution isn't exactly

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 to insert transparent PNG in PDF?

有些话、适合烂在心里 提交于 2019-12-22 03:40:32
问题 I am able to insert JPG image into a PDF document with DCTDecode filter. I think the all parameters should be the same for PNG image too, except the filter which should be FlateDecode . However, when I try to insert PNG with the same parameters, the PNG image is not visible in he PDF document. UPDATE: I came to conclusion that the PDF file should include 1 0 obj << /Type /XObject /Subtype /Image /Width 512 /Height 512 /BitsPerComponent 8 /ColorSpace /DeviceRGB /SMask 9 0 R /Length 134753