-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image export broken on components #210
Comments
The solution might be to get the size of the exported image and use that rather than the native size of the node. This is an AI generated function for getting the dimensions of a PNG file and it could be called in images.ts line 75 const getImageDimensionsFromBytes = (
bytes: Uint8Array,
): { width: number; height: number } => {
// Check if the bytes represent a valid PNG file
const pngSignature = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
for (let i = 0; i < pngSignature.length; i++) {
if (bytes[i] !== pngSignature[i]) {
console.error("Invalid PNG file");
return { width: -1, height: -1 };
}
}
// The IHDR chunk starts at byte 16
const width =
(bytes[16] << 24) | (bytes[17] << 16) | (bytes[18] << 8) | bytes[19];
const height =
(bytes[20] << 24) | (bytes[21] << 16) | (bytes[22] << 8) | bytes[23];
return { width, height };
}; |
I wonder what is different from frame to component |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bug.fig.zip
The text was updated successfully, but these errors were encountered: