Skip to content

Commit

Permalink
Use image_data() to consistently get 4 channel bitmap array, fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed May 27, 2018
1 parent 77e552a commit e49b70d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -15,7 +15,7 @@ Imports:
tibble,
Rcpp,
RcppParallel,
magick,
magick (>= 1.6),
purrr,
magrittr,
dplyr,
Expand Down
3 changes: 2 additions & 1 deletion R/histogram.R
Expand Up @@ -34,11 +34,12 @@
#'
#' @importFrom tibble as_tibble
#' @importFrom dplyr mutate
#' @importFrom magick image_data
#' @importFrom magrittr %>%
#'
#' @export
image_histogram_data <- function(im){
bitmap <- im[[1]]
bitmap <- image_data(im, 'rgba')
as_tibble(magick_image_histogram(bitmap))
}

Expand Down
2 changes: 1 addition & 1 deletion R/pixelize.R
@@ -1,6 +1,6 @@
as_bitmap <- function(img){
if( inherits(img, "magick-image")){
img <- img[[1]]
img <- image_data(img, 'rgba')
}
img
}
Expand Down

0 comments on commit e49b70d

Please sign in to comment.