Skip to content

Commit

Permalink
Merge pull request #59 from JuliaIO/teh/rgbx
Browse files Browse the repository at this point in the history
Add compat bounds and update to XRGB/RGBX
  • Loading branch information
rsrock authored Jan 25, 2020
2 parents e587240 + 5992a6c commit f6a7770
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ language: julia
os:
- osx
julia:
- 0.7
- 1.0
- 1
- nightly
matrix:
allow_failures:
Expand Down
20 changes: 10 additions & 10 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "QuartzImageIO"
uuid = "dca85d43-d64c-5e67-8c65-017450d5d020"
version = "0.6.0"
version = "0.7.0"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand All @@ -11,15 +11,15 @@ ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[compat]
ColorTypes = "≥ 0.3.0"
ColorVectorSpace = "≥ 0.2.0"
FileIO = "≥ 1.0.0"
FixedPointNumbers = "≥ 0.3.0"
ImageAxes = "≥ 0.2.0"
ImageCore = "0.7.0"
ImageMetadata = " 0.4.1"
TestImages = " 0.1.3"
julia = "≥ 0.7.0"
ColorTypes = "0.9"
ColorVectorSpace = "0.8"
FileIO = "1"
FixedPointNumbers = "0.6.1, 0.7"
ImageAxes = "0.6"
ImageCore = "0.7, 0.8"
ImageMetadata = "0.5, 0.6, 0.7, 0.8"
TestImages = "0.4, 0.5, 0.6, 1"
julia = "1"

[extras]
ImageAxes = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac"
Expand Down
6 changes: 3 additions & 3 deletions src/QuartzImageIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function read_and_release_imgsrc(imgsrc)
buf = Array{RGB{T}}(undef, sz)
fillcolor!(reshape(reinterpret(T, buf), (3, sz...)), imgsrc, storagedepth)
elseif colormodel == "RGB" && alphacode [5, 6]
buf = alphacode == 5 ? Array{RGB4{T}}(undef, sz) : Array{RGB1{T}}(undef, sz)
buf = alphacode == 5 ? Array{RGBX{T}}(undef, sz) : Array{XRGB{T}}(undef, sz)
fillcolor!(reshape(reinterpret(T, buf), (4, sz...)), imgsrc, storagedepth)
else
@warn "Unknown colormodel ($colormodel) and alphacode ($alphacode) found by QuartzImageIO"
Expand Down Expand Up @@ -241,7 +241,7 @@ function save_(f::File{R}, img::AbstractArray;
bitmap_info |= kCGImageAlphaNone
colorspace = CGColorSpaceCreateWithName("kCGColorSpaceGenericGray")
components = 1
elseif T <: Union{RGB, RGB4, HSV, HSL, Lab}
elseif T <: Union{RGB, RGBX, HSV, HSL, Lab}
bitmap_info |= kCGImageAlphaNoneSkipLast
colorspace = CGColorSpaceCreateWithName("kCGColorSpaceSRGB")
components = 4
Expand Down Expand Up @@ -350,7 +350,7 @@ mapCG(c::GrayA{T}) where T <: Normed = convert(Gray, c)
mapCG(c::Color3) = mapCG(convert(RGBA, c))
mapCG(c::RGB{T}) where T = convert(RGBA{N0f8}, c)
mapCG(c::RGB{T}) where T <: Normed = convert(RGBA{T}, c)
mapCG(c::RGB4{T}) where T <: Real = convert(RGBA{T}, c)
mapCG(c::RGBX{T}) where T <: Real = convert(RGBA{T}, c)

mapCG(c::Color4) = mapCG(convert(RGBA, c))
mapCG(c::RGBA{T}) where T = convert(RGBA{N0f8}, c)
Expand Down
22 changes: 13 additions & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ispath(mydir) || mkdir(mydir)
name = "earth_apollo17"
img = testimage(name)
@test ndims(img) == 2
@test eltype(img) == RGB4{N0f8}
@test eltype(img) == RGBX{N0f8}
@test size(img) == (3002, 3000)
out_name = joinpath(mydir, name * ".png")
save(out_name, img)
Expand All @@ -67,7 +67,7 @@ ispath(mydir) || mkdir(mydir)
name = "fabio"
img = testimage(name)
@test ndims(img) == 2
@test eltype(img) == RGB4{N0f8}
@test eltype(img) == RGBX{N0f8}
@test size(img) == (256, 256)
out_name = joinpath(mydir, name * ".png")
save(out_name, img)
Expand Down Expand Up @@ -110,7 +110,7 @@ ispath(mydir) || mkdir(mydir)
name = "lighthouse"
img = testimage(name)
@test ndims(img) == 2
@test eltype(img) == RGB4{N0f8}
@test eltype(img) == RGBX{N0f8}
@test size(img) == (512, 768)
out_name = joinpath(mydir, name * ".png")
save(out_name, img)
Expand Down Expand Up @@ -149,7 +149,7 @@ ispath(mydir) || mkdir(mydir)
name = "mountainstream"
img = testimage(name)
@test ndims(img) == 2
@test eltype(img) == RGB4{N0f8}
@test eltype(img) == RGBX{N0f8}
@test size(img) == (512, 768)
out_name = joinpath(mydir, name * ".png")
save(out_name, img)
Expand Down Expand Up @@ -204,7 +204,7 @@ ispath(mydir) || mkdir(mydir)
name = "blobs"
img = testimage(name)
@test ndims(img) == 2
@test eltype(img) == RGB4{N0f8}
@test eltype(img) == RGBX{N0f8}
@test size(img) == (254, 256)
# Unclear why this needs to be a .png
out_name = joinpath(mydir, name * ".png")
Expand All @@ -218,10 +218,14 @@ ispath(mydir) || mkdir(mydir)
# So, we need to do some extra work to call the image
# with our specific loader here.
mcifile = "multi-channel-time-series.ome.tif"
name = joinpath(TestImages.imagedir, mcifile)
if !isfile(name)
REPO_URL = "https://github.com/JuliaImages/TestImages.jl/blob/gh-pages/images/"
download(REPO_URL*mcifile*"?raw=true", name)
if !isdefined(TestImages, :image_path)
name = joinpath(TestImages.imagedir, mcifile)
if !isfile(name)
REPO_URL = "https://github.com/JuliaImages/TestImages.jl/blob/gh-pages/images/"
download(REPO_URL*mcifile*"?raw=true", name)
end
else
name = TestImages.image_path(TestImages.full_imagename(mcifile))
end
img = QuartzImageIO.load(name)
@test ndims(img) == 3
Expand Down

4 comments on commit f6a7770

@timholy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/8419

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.0 -m "<description of version>" f6a7770b83a7e4ca29745623636ef426c59b3bca
git push origin v0.7.0

@rsrock
Copy link
Contributor Author

@rsrock rsrock commented on f6a7770 Jan 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see that Registrator is already set up here (thru JuliaIO, I guess?). I was struggling to figure that part out. Thanks!

@timholy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, tagbot is set up too: https://github.com/JuliaIO/QuartzImageIO.jl/releases. Easy-peasy 😄.

Please sign in to comment.