From 2e1cce438be0a03f0cc037c95afa136b293a054c Mon Sep 17 00:00:00 2001 From: carrot <149851+lopcode@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:49:15 +0000 Subject: [PATCH] Use more intuitive thumbnail image operation in examples --- README.md | 9 ++++----- .../kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 390ee2a..0c5a118 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,7 @@ Vips.init() Vips.run { arena -> val sourceImage = VImage.newFromFile( arena, - "sample/src/main/resources/sample_images/rabbit.jpg", - VipsOption.Enum("access", VipsAccess.ACCESS_SEQUENTIAL) // example of an option + "sample/src/main/resources/sample_images/rabbit.jpg" ) val sourceWidth = sourceImage.width val sourceHeight = sourceImage.height @@ -88,9 +87,9 @@ Vips.run { arena -> val outputPath = workingDirectory.resolve("rabbit_copy.jpg") sourceImage.writeToFile(outputPath.absolutePathString()) - val thumbnail = sourceImage.thumbnail( - "sample/src/main/resources/sample_images/rabbit.jpg", - 400 + val thumbnail = sourceImage.thumbnailImage( + 400, + VipsOption.Boolean("auto-rotate", true) // example of an option ) val thumbnailWidth = thumbnail.width val thumbnailHeight = thumbnail.height diff --git a/sample/src/main/kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt b/sample/src/main/kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt index c7ac1fe..f28ac09 100644 --- a/sample/src/main/kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt +++ b/sample/src/main/kotlin/vipsffm/sample/VImageCreateThumbnailSample.kt @@ -20,8 +20,7 @@ object VImageCreateThumbnailSample: RunnableSample { override fun run(arena: Arena, workingDirectory: Path): Result { val sourceImage = VImage.newFromFile( arena, - "sample/src/main/resources/sample_images/rabbit.jpg", - VipsOption.Enum("access", VipsAccess.ACCESS_SEQUENTIAL) + "sample/src/main/resources/sample_images/rabbit.jpg" ) val sourceWidth = sourceImage.width val sourceHeight = sourceImage.height @@ -30,9 +29,9 @@ object VImageCreateThumbnailSample: RunnableSample { val outputPath = workingDirectory.resolve("rabbit_copy.jpg") sourceImage.writeToFile(outputPath.absolutePathString()) - val thumbnail = sourceImage.thumbnail( - "sample/src/main/resources/sample_images/rabbit.jpg", - 400 + val thumbnail = sourceImage.thumbnailImage( + 400, + VipsOption.Boolean("auto-rotate", true) // example of an option ) val thumbnailWidth = thumbnail.width val thumbnailHeight = thumbnail.height