fix(coding-agent): Fix EXIF orientation for JPEG and WebP images (#2105)
* fix(coding-agent): apply EXIF orientation correction during image convert and resize * docs(coding-agent): add PR reference to changelog entry
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { applyExifOrientation } from "./exif-orientation.js";
|
||||
import { loadPhoton } from "./photon.js";
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,9 @@ export async function convertToPng(
|
||||
|
||||
try {
|
||||
const bytes = new Uint8Array(Buffer.from(base64Data, "base64"));
|
||||
const image = photon.PhotonImage.new_from_byteslice(bytes);
|
||||
const rawImage = photon.PhotonImage.new_from_byteslice(bytes);
|
||||
const image = applyExifOrientation(photon, rawImage, bytes);
|
||||
if (image !== rawImage) rawImage.free();
|
||||
try {
|
||||
const pngBuffer = image.get_bytes();
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user