Comments (7)
@coreyward Hi Corey! Thanks for opening this issue. It's mentioned that you're using photon
, however there is a separate library photon-node
for Node environments, linked here. Could you try this and see if it works? If not, could you provide the image or base64 string also, as it would help diagnose the issue. Thanks very much! π π
from photon.
@silvia-odwyer Oops that was just a typo in my post. I'm using photon-node
in my code. I don't think the base64 string matters here as it happens even with this 3-line example going the other direction:
const photon = require("@silvia-odwyer/photon-node")
const img = new photon.PhotonImage([], 10, 10)
img.get_base64()
For reference, this occurred with every base64 string I tried, and I verified syntax on several by doing pbpaste | base64 --decode > test.jpg
and confirming that the file operated like normal (e.g. in Preview/QuickLook).
from photon.
Here's a CodeSandbox example demonstrating the issue. It actually seems to work fine when creating the image from the PNG data, but the JPG fails.
This is the source of the PNG. I convert it to JPEG using some built-in routine in Finder, resulting in the image attached here, for reference:
from photon.
@coreyward Thanks very much for the CodeSandbox example, it's much appreciated! π I've taken a look at the issue, and it seems to be linked to Issue #120. The rayon
feature seems to be causing the bug in relation to creating jpeg images from base64.
To fix this, I've just published a new build. Could you update your photon-node
dependency to 0.3.2 and let me know if it solves the issue? Thanks very much! π π
from photon.
Thank you! It looks like this allows const img = photon.PhotonImage.new_from_base64(redSquareJpgB64);
to succeed π , but calling img.get_image_data()
or photon.get_image_data(img)
on the result results in the same βunreachableβ error. Calling photon.grayscale(img)
like the guide shows results in βUncaught: Error: recursive use of an object detected which would lead to unsafe aliasing in rustβ. Am I doing something wrong here?
from photon.
Hi Corey,
I've just ran the example mentioned in the guide here, and it worked as expected. However when I included a line to get the image data, it did result in an unreachable error. I'll have to investigate why that is, although creating png/jpg images with base64 and writing the output is all working okay for me.
If you can't seem to apply effects etc, just include a code snippet and I'll try help out! π π
from photon.
Hi there, I'm also seeing this via get_image_data using ^0.3.3:
const base64 = fs.readFileSync(imagePath, { encoding: 'base64' });
const data = base64.replace(/^data:image\/(png|jpg);base64,/, "");
const phtn_img = photon.PhotonImage.new_from_base64(data);
photon.laplace(phtn_img)
phtn_img.get_image_data();
RuntimeError: unreachable
at wasm://wasm/0052704a:wasm-function[1043]:0xf0618
at wasm://wasm/0052704a:wasm-function[1159]:0xf5558
at wasm://wasm/0052704a:wasm-function[1359]:0xfb0dc
at wasm://wasm/0052704a:wasm-function[1520]:0xfdf67
at wasm://wasm/0052704a:wasm-function[1204]:0xf6eec
at wasm://wasm/0052704a:wasm-function[1157]:0xf5437
at PhotonImage.get_image_data (/Users/mattgardner/archive-dol-arpa-income-verification/app/node_modules/@silvia-odwyer/photon-node/photon_rs.js:3905:24)
EDIT: Okay... I think this is a buried error over needing to apply another .replace(/^data:image\/(png|jpg);base64,/, "");
from photon.
Related Issues (20)
- Some filters are not working HOT 1
- How to use `open_image_from_bytes`? HOT 3
- Use without wasm HOT 4
- Watermark with opacity HOT 1
- Pixel Byte vs Bytes HOT 1
- web workers ? HOT 1
- Question: Any workflow to work with stereo image pairs?
- Can use photon with 16 bit grayscale images?
- Creating security.md HOT 1
- How to selectively convert alpha channel?
- WebP | AVIF HOT 1
- Add LUT / Windowing for medical images
- Heif
- Noise added on image rotation. HOT 1
- Image file size on disk HOT 2
- Resizing Options
- Initializing PhotonImage multiple times would run into OOM in Node v20 HOT 1
- malloc is not a function. (In 'malloc(arg.length * 1, 1)', 'malloc' is undefined)
- Why crop need a mutable reference to an image HOT 1
- Paeth-Rotate and Shear 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 photon.