You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using jpeg-js library to decode an image, apply my own greyscale filter, and encode it back. But unfortunately every vertical picture I process for some reason is rotated and saved horizontally (while horizontal images preserve its correct rotation and are totally ok). Here's my code:
At first I thought that the problem might be hidden in the greyscale function and how I process pixels. So I tried to decode, encode, and save back an original, unfiltered, vertical photo, which had lead to the same result: unexpected rotation.
Have you ever faced a problem like this and does anyone know how to fix it? It's also important to me to use a pure js implementation instead of libraries like Sharp
The text was updated successfully, but these errors were encountered:
I'm using jpeg-js library to decode an image, apply my own greyscale filter, and encode it back. But unfortunately every vertical picture I process for some reason is rotated and saved horizontally (while horizontal images preserve its correct rotation and are totally ok). Here's my code:
`function greyscale(width, height, data, bytesPerPixel, imageName) {
const bwPixelData = Buffer.alloc(data.length)
}
exports.decodeImage = function(name, path) {
if (name.match(/.*.jpe?g/i)){
const jpegData = fs.readFileSync(path)
return jpeg.decode(jpegData)
} else {
throw new Error('Unsupported Media Type')
}
}
exports.encodeImage = function(data, width, height, imageName) {
} `
At first I thought that the problem might be hidden in the greyscale function and how I process pixels. So I tried to decode, encode, and save back an original, unfiltered, vertical photo, which had lead to the same result: unexpected rotation.
Have you ever faced a problem like this and does anyone know how to fix it? It's also important to me to use a pure js implementation instead of libraries like Sharp
The text was updated successfully, but these errors were encountered: