Skip to content

Commit

Permalink
Use more intuitive thumbnail image operation in examples (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
lopcode authored Nov 17, 2024
1 parent b32f270 commit b45a6e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ object VImageCreateThumbnailSample: RunnableSample {
override fun run(arena: Arena, workingDirectory: Path): Result<Unit> {
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
Expand All @@ -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
Expand Down

0 comments on commit b45a6e8

Please sign in to comment.