Skip to content

Commit

Permalink
try fixing CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Feb 2, 2023
1 parent cedea04 commit 1d11825
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ version = "1.2.2"

[deps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Ghostscript_jll = "61579ee1-b43e-5ca0-a5da-69d92c66a64b"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageMagick_jll = "c73af94c-d91f-53ed-93a7-00f77d67a9d7"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[compat]
FileIO = "1"
Ghostscript_jll = "= 9.55.0"
ImageCore = "0.8.1, 0.9"
ImageMagick_jll = "= 6.9.10"
julia = "1.3"
Expand Down
1 change: 1 addition & 0 deletions src/ImageMagick.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using InteractiveUtils: subtypes
using ImageCore
using ImageMagick_jll
using Base: convert
using Ghostscript_jll

Color1{T} = Color{T,1}
Color2{T,C<:Color1} = TransparentColor{C,T,2}
Expand Down
14 changes: 10 additions & 4 deletions src/libmagickwand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,31 @@ function pingimage(wand::MagickWand, filename::AbstractString)
nothing
end

function readimage(wand::MagickWand, filename::AbstractString)
function readimage(wand::MagickWand, from)
withenv("PATH" => "$(Ghostscript_jll.PATH[]):$(ENV["PATH"])") do
_readimage(wand, from)
end
end

function _readimage(wand::MagickWand, filename::AbstractString)
status = ccall((:MagickReadImage, libwand), Cint, (Ptr{Cvoid}, Ptr{UInt8}), wand, filename)
status == 0 && error(wand)
nothing
end

function readimage(wand::MagickWand, stream::IO)
function _readimage(wand::MagickWand, stream::IO)
status = ccall((:MagickReadImageFile, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}), wand, Libc.FILE(stream).ptr)
status == 0 && error(wand)
nothing
end

function readimage(wand::MagickWand, stream::Vector{UInt8})
function _readimage(wand::MagickWand, stream::Vector{UInt8})
status = ccall((:MagickReadImageBlob, libwand), Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cint), wand, stream, length(stream)*sizeof(eltype(stream)))
status == 0 && error(wand)
nothing
end

readimage(wand::MagickWand, stream::IOBuffer) = readimage(wand, stream.data)
_readimage(wand::MagickWand, stream::IOBuffer) = readimage(wand, stream.data)

function writeimage(wand::MagickWand, filename::AbstractString)
status = ccall((:MagickWriteImages, libwand), Cint, (Ptr{Cvoid}, Ptr{UInt8}, Cint), wand, filename, true)
Expand Down

0 comments on commit 1d11825

Please sign in to comment.