Comments (6)
Even if we do the migration, I don't see any reason not to fix n0f8(RGB24)
etc. in the current ImageCore. (I'm not sure whether n0f8(RGB24)
should return RGB{N0f8}
or RGB24
, though.)
from colors.jl.
I think it's straightforward to define n0f8
and so on in FixedPointNumbers
and implement n0f8(::Colorant)
and so on in ColorTypes
. However, I'm not sure that it's really a good idea for FixedPointNumbers
to provide such non-generic functions.
Also, I don't think float32
and float64
are functions that should be exported by the low-level packages.
However, I think the following should be solved within ColorTypes.
julia> convert(Colorant{Float32}, RGB24(1))
ERROR: nonparametric type RGB24 has ambiguous destination Colorant{Float32, N} where N
(Of course, this is a known issue:
https://github.com/JuliaGraphics/ColorTypes.jl/blob/81297fff41e28dc64ace72a37c090ee22363ba71/test/conversions.jl#L446)
from colors.jl.
Makes sense to me; either move or not are good. We can keep this issue open until we decide the 1.0 status.
from colors.jl.
I have no objection to "defining" them in Colors or ColorTypes, but I am not comfortable exporting them. 😕
I can fully understand why you would prefer to have them defined in Colors (or ColorTypes), but I don't see what the trouble is with having them in ImageCore.
The same goes for clamp01
and clamp01nan
.(cf. #469 (comment))
from colors.jl.
Also, as you know, there is the inconsistency problem with float
other than for FixedPoint
/AbstractFloat
.
from colors.jl.
I have no objection to "defining" them in Colors or ColorTypes, but I am not comfortable exporting them.
I'm okay with this since it's mainly the package developer that needs to take care of the storage type.
My main consideration when proposing this move is that I want to give better support for them on broader color types. Currently,
julia> n0f8(RGB)
RGB{N0f8}
julia> n0f8(RGB{Float32})
RGB{N0f8}
julia> n0f8(RGB24)
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Type{RGB24}
Stacktrace:
[1] n0f8(#unused#::Type{RGB24})
@ ImageCore ~/.julia/packages/ImageCore/iXG0W/src/convert_reinterpret.jl:82
[2] top-level scope
@ REPL[21]:1
This need arises when I tried to convert all colorant images to N0f8/UInt8 byte sequences:
canonical_colorant_type(::Type{CT}) where CT<:Colorant = n0f8(CT)
canonical_colorant_type(::Type{T}) where T<:Real = Gray{N0f8}
but I don't see what the trouble is with having them in ImageCore.
The only reason that I feel it better to live in Colors is that they are pixel-level operations. 😄
from colors.jl.
Related Issues (20)
- Not work on Ubuntu 2004 HOT 5
- RGB -> XTerm256 approximation? HOT 13
- Optimizing the types used for intermediate calculations HOT 5
- Source of the YIQ transform matrix HOT 1
- is `inv` on Colors well defined? HOT 4
- Fatal performance degradation due to precompilation or inference bugs HOT 8
- MethodError: no method matching coloralpha(::Type{RGB24}) HOT 1
- What should `default_brettel_neutral` be? HOT 1
- Ambiguity with AbstractTrees
- 'Render' colours in REPL HOT 15
- in the README, put a link on the home page HOT 2
- colorwheel generator HOT 1
- add colorwheel generator HOT 1
- Release v0.13? HOT 2
- Ambiguous show method for `Union{}[]` HOT 3
- colormap("<Color>", maxcount; w=<Int>, logscale=<Bool>) stackoverflows HOT 7
- oklab/oklch for CSS4 and cheap deltaE HOT 1
- BGR interpreted as RGB HOT 1
- Luv and LCHuv gives incorrect color values for low lightness cyan HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from colors.jl.