Compare commits

..

2 Commits

Author SHA1 Message Date
Lovell Fuller
67462bee79 CI: Simplify volume mappings for linuxmusl-arm64 runners 2025-07-19 14:45:07 +01:00
Lovell Fuller
628454559e Ensure autoOrient removes metadata after shrink-on-load #4431 2025-07-19 14:00:42 +01:00
5 changed files with 31 additions and 12 deletions

View File

@ -169,7 +169,7 @@ jobs:
path: npm/${{ matrix.platform }} path: npm/${{ matrix.platform }}
retention-days: 1 retention-days: 1
if-no-files-found: error if-no-files-found: error
build-linuxmusl-arm-64: build-linuxmusl-arm64:
permissions: permissions:
contents: read contents: read
name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}" name: "build-linuxmusl-arm64 [Node.js ${{ matrix.nodejs_version_major }}] ${{ matrix.package && '[package]' }}"
@ -177,7 +177,8 @@ jobs:
container: container:
image: ${{ matrix.container }} image: ${{ matrix.container }}
volumes: volumes:
- /:/host - /opt:/opt:rw,rshared
- /opt:/__e/node20:ro,rshared
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -191,12 +192,10 @@ jobs:
- name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757 - name: Allow Linux musl containers on ARM64 runners # https://github.com/actions/runner/issues/801#issuecomment-2394425757
shell: sh shell: sh
run: | run: |
apk add nodejs sed -i "/^ID=/s/alpine/NotpineForGHA/" /etc/os-release
sed -i "s:ID=alpine:ID=NotpineForGHA:" /etc/os-release apk add nodejs --update-cache
cd /host/home/runner/runners/*/externals/ mkdir /opt/bin
rm -rf node20/* ln -s /usr/bin/node /opt/bin/node
mkdir node20/bin
ln -s /usr/bin/node node20/bin/node
- name: Dependencies - name: Dependencies
run: apk add build-base git python3 font-noto --update-cache run: apk add build-base git python3 font-noto --update-cache
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -304,7 +303,7 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
needs: needs:
- build-native - build-native
- build-linuxmusl-arm-64 - build-linuxmusl-arm64
- build-qemu - build-qemu
- build-emscripten - build-emscripten
steps: steps:

View File

@ -0,0 +1,7 @@
---
title: v0.34.4 - TBD
slug: changelog/v0.34.4
---
* Ensure `autoOrient` removes existing metadata after shrink-on-load.
[#4431](https://github.com/lovell/sharp/issues/4431)

View File

@ -98,7 +98,6 @@ class PipelineWorker : public Napi::AsyncWorker {
if (baton->input->autoOrient) { if (baton->input->autoOrient) {
// Rotate and flip image according to Exif orientation // Rotate and flip image according to Exif orientation
std::tie(autoRotation, autoFlip, autoFlop) = CalculateExifRotationAndFlip(sharp::ExifOrientation(image)); std::tie(autoRotation, autoFlip, autoFlop) = CalculateExifRotationAndFlip(sharp::ExifOrientation(image));
image = sharp::RemoveExifOrientation(image);
} }
rotation = CalculateAngleRotation(baton->angle); rotation = CalculateAngleRotation(baton->angle);
@ -294,6 +293,9 @@ class PipelineWorker : public Napi::AsyncWorker {
throw vips::VError("Input SVG image exceeds 32767x32767 pixel limit"); throw vips::VError("Input SVG image exceeds 32767x32767 pixel limit");
} }
} }
if (baton->input->autoOrient) {
image = sharp::RemoveExifOrientation(image);
}
// Any pre-shrinking may already have been done // Any pre-shrinking may already have been done
inputWidth = image.width(); inputWidth = image.width();

View File

@ -322,8 +322,6 @@ describe('Raw pixel data', function () {
.gif({ keepDuplicateFrames: true }) .gif({ keepDuplicateFrames: true })
.toBuffer(); .toBuffer();
console.log(await sharp(gif).metadata());
const { width, height, pages, delay } = await sharp(gif).metadata(); const { width, height, pages, delay } = await sharp(gif).metadata();
assert.strictEqual(width, 1); assert.strictEqual(width, 1);
assert.strictEqual(height, 1); assert.strictEqual(height, 1);

View File

@ -635,6 +635,19 @@ describe('Rotation', function () {
assert.strictEqual(height, 6); assert.strictEqual(height, 6);
}); });
it('Shrink-on-load with autoOrient', async () => {
const data = await sharp(fixtures.inputJpgWithLandscapeExif6)
.resize(8)
.autoOrient()
.avif({ effort: 0 })
.toBuffer();
const { width, height, orientation } = await sharp(data).metadata();
assert.strictEqual(width, 8);
assert.strictEqual(height, 6);
assert.strictEqual(orientation, undefined);
});
it('Invalid autoOrient throws', () => it('Invalid autoOrient throws', () =>
assert.throws( assert.throws(
() => sharp({ autoOrient: 'fail' }), () => sharp({ autoOrient: 'fail' }),