Questions tagged [magick-r-package]

The magick package: Advanced Image-Processing in R

Resources:

  1. github
  2. cran.r-project.org
21 questions
6
votes
1 answer

R: Convert/Read 3D Matrix into a 'magick' object and vice versa

I want to work with the magick package for its fantastic image manipulations capabilities. Looking through here I can't seem to find out how to convert a 3D matrix (width x height x channels) to a magick object I can further manipulate, and vice…
Giora Simchoni
  • 3,487
  • 3
  • 34
  • 72
5
votes
1 answer

Split string to columns based on paragraph ending from ocr'd image

I'm working on a project to convert type-writer written War Diary notes into text, from PDF scans. I can successfully (maybe 90% with original non-re-sized file) extract the main text, which I crop first. Reprex data: You could try this from the…
Corey Pembleton
  • 717
  • 9
  • 23
4
votes
2 answers

Processing multiple images with Magick (in R) with transformations

I need to automate some image transformations to do the following: - read in 16,000+ images that are short and wide, sizing is not the same. - rescale each image to 90 pixels high - crop 90 pixels over the width of the image, so multiple 90x90…
techster
  • 43
  • 6
4
votes
3 answers

Import png files and convert to animation(.mp4) in R

I'm trying to create a short animation with several png files in R. I tried package magick but it only works when I save them to .gif. When I tried to save as .mp4, it will generate an .mp4 file but once you open it, only the first image will be…
Arthur
  • 398
  • 6
  • 20
3
votes
2 answers

Convert .png to multi-page pdf using Magick in R

I have a directory full of 100 .png images I'd like to convert to pdf. The images are exactly the size I want the pdf to be. I can create a multi-page pdf using magick "manually" like this: library(magick) img1 <- image_read("image1.png") img2 <-…
Nova
  • 5,423
  • 2
  • 42
  • 62
3
votes
1 answer

magick annotate picture with arrows

I need to add a arrow to a picture. Currently I'm using the code below but I want to make the arrow longer. library(magick) tiger <- image_read_svg('http://jeroen.github.io/images/tiger.svg', width = 400) print(tiger) tiger %>% …
user3357059
  • 1,122
  • 1
  • 15
  • 30
2
votes
0 answers

Distortions while reading svg with magick in R

I am trying to read a svg image (created with inkscape) with magick in R. From the introduction here, imagemagick can read svg image. This is the svg image that I am trying to…
Suman Khanal
  • 3,079
  • 1
  • 17
  • 29
2
votes
0 answers

gganimate package: argument 'fps' must be a factor of 100

When I try to use the sample in gganimate package as following (copied from help("transition_manual")) anim <- ggplot(mtcars, aes(factor(gear), mpg)) +geom_boxplot() +transition_manual(gear) I get following error: Error in…
1
vote
0 answers

Saving images with Magick

I'm trying to automate adding my signature to my photos using the magick package - but I'm having problems saving them. Here's my code: file_list <- dir(".", pattern = "*.png") mySig <- image_read("~/Desktop/sig1.png") mySig <- mySig %>%…
Mulligan
  • 85
  • 7
1
vote
2 answers

How to (quickly) batch process multiple images and run through tesseract

I've successfully extracted text from a single pdf using a combination of magick-r and tesseract, but have hit a roadblock when trying to process multiple images.(It is for a non-profit organization) I welcome answers in bash, but ask that they are…
Corey Pembleton
  • 717
  • 9
  • 23
1
vote
1 answer

classify a large collection of image files

I have a large collection of image files for a book, andthe publisher wants a list where files are classified by "type" (greyscale graph, b/w halftone image, color image, line drawing, etc.). This is a hard problem in general, but perhaps I can do…
user101089
  • 3,756
  • 1
  • 26
  • 53
1
vote
0 answers

Trouble reading tif images using image_read in Magick package

I am trying to read a .tif image from a local directory using the image_read command in the Magick package. My code results in the following error: "Error in magick_image_readpath(path, density, depth, strip) : Magick: Incompatible type for…
marcel
  • 389
  • 1
  • 8
  • 21
1
vote
1 answer

Change size and aspect ratio without distortion

i'm searching for a way in R to make 400x400px images (.jpg/.png) out of a larger images of different size and aspect size without distorting it. The new image should have most of the content of the original one but can be cut off a bit on the left…
1
vote
2 answers

How to use purrr:map() and rlang to emulate a pipe chain

There are several packages such as leaflet or magick that take special objects (maps or images, respectively), and allow them to be modified/added to using a pipe chain. I would like to get the same behavior using a list of tibbles with the function…
jzadra
  • 4,012
  • 2
  • 26
  • 46
0
votes
2 answers

Crop images based on number of text length

I have a dataset with a column storing hundreds of writing samples. My goal is to export each writing sample into a separate image. Below, my current code: library(tidyverse) library(ggplot2) library(ggtext) library(magick) df <- data.frame( …
Michael Matta
  • 394
  • 2
  • 16
1
2