How to manipulate raw pixel data?
See original GitHub issueI was wondering how I can access the raw pixel byte array of an Image
in Skija. After loading an Image
via Image.makeFromEncoded
I somehow could not find a good way to convert the Image
to a Bitmap
. And even if I would be able to create a Bitmap
there seems no accessor for the raw byte[]
of the image representing the pixels. I need to do some raw pixel manipulation (for diffing purposes).
On SkiaSharp you can create a SKBitmap
either by using SKBitmap.Decode()
or via SKBitmap.FromImage
. The raw pixels are then accessible via skBitmap.Bytes
.
Is this missing in Skija?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Pixel manipulation with canvas - Web APIs | MDN
The data property returns a Uint8ClampedArray which can be accessed to look at the raw pixel data; each pixel is represented by four...
Read more >Manipulating Raw Pixel Data in Canvas: HTML5 - YouTube
http://technotip.com/3421/accessing- raw - pixel - data -in-canvas-html5/Today lets learn how to access individual pixel data on canvas, ...
Read more >D Raw Pixel Format
The raw pixel format is useful for applications that need direct access to the pixel data without the encumbrance of the complex computations...
Read more >Modifying raw image data for experiments
Modifying raw image data for experiments ; Convert the raw file to a PGM by running unprocessed_raw <raw filename> ; Load the PGM...
Read more >Accessing Raw Pixel Data in Canvas: HTML5 - Technotip.com
We draw an image on to the canvas using drawImage() method. Once we draw the image, we get all the raw pixel data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Added everything except SKBitmap.Decode (will add later). Check out https://github.com/JetBrains/skija/blob/3fda7b5b74a42b2b015bebe2031fccff631fb409/examples/scenes/src/BitmapImageScene.java for examples. From your description, you should be able to do what you set up to do. Jar version 0.89.32
Thanks for the fast reply. Digging deeper I saw that there are quite some essentials missing. My use cases would be:
Image
toBitmap
for accessing the actual image contents. Related SkiaSharp methods:SKBitmap.Decode(SKData)
,SKBitmap.FromImage(SKImage)
Bitmap
toImage
for saving the bitmap again to disk after manipulations. Related SkiaSharp method:SKImage.FromBitmap(SKBitmap)
Bitmap
for raw pixel manipulations. I want to do diffing of images with anti-alias detection, basically a port of PixelMatch. Related SkiaSharp property:SKBitmap.Bytes
SKImage.FromPixels(SKImageInfo, SKData)
Hope this helps as input to cover my needs 😁 .