com.domenicseccareccia:jpeg-autorotate

A Java library to rotate JPEG images based on EXIF orientation

License

License

Categories

Categories

Auto Application Layer Libs Code Generators
GroupId

GroupId

com.domenicseccareccia
ArtifactId

ArtifactId

jpeg-autorotate
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

com.domenicseccareccia:jpeg-autorotate
A Java library to rotate JPEG images based on EXIF orientation
Project URL

Project URL

https://github.com/domsec/jpeg-autorotate
Source Code Management

Source Code Management

https://github.com/domsec/jpeg-autorotate/tree/master

Download jpeg-autorotate

How to add to project

<!-- https://jarcasting.com/artifacts/com.domenicseccareccia/jpeg-autorotate/ -->
<dependency>
    <groupId>com.domenicseccareccia</groupId>
    <artifactId>jpeg-autorotate</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.domenicseccareccia/jpeg-autorotate/
implementation 'com.domenicseccareccia:jpeg-autorotate:1.1.0'
// https://jarcasting.com/artifacts/com.domenicseccareccia/jpeg-autorotate/
implementation ("com.domenicseccareccia:jpeg-autorotate:1.1.0")
'com.domenicseccareccia:jpeg-autorotate:jar:1.1.0'
<dependency org="com.domenicseccareccia" name="jpeg-autorotate" rev="1.1.0">
  <artifact name="jpeg-autorotate" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.domenicseccareccia', module='jpeg-autorotate', version='1.1.0')
)
libraryDependencies += "com.domenicseccareccia" % "jpeg-autorotate" % "1.1.0"
[com.domenicseccareccia/jpeg-autorotate "1.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.commons : commons-imaging jar 1.0-alpha2
commons-io : commons-io jar 2.8.0

test (2)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-api jar 5.7.0
org.junit.jupiter : junit-jupiter-engine jar 5.7.0

Project Modules

There are no modules declared in this project.

Logo

Build Status Maven Central with version prefix filter javadoc

JPEG Autorotate is a Java library to rotate JPEG images based on EXIF orientation.


Features

Applies the right orientation to a JPEG image, based on its EXIF tag. More precisely, it:

  • Rotates the pixels
  • Rotates the thumbnail, if present
  • Sets the Orientation EXIF tag to 1 (default orientation value)
  • Updates the following metadata values, if present:
    • EXIF
      • ExifImageWidth
      • ExifImageLength
      • RelatedImageWidth
      • RelatedImageHeight
    • XMP
      • tiff:Orientation
      • tiff:ImageWidth
      • tiff:ImageLength
      • exif:PixelXDimension
      • exif:PixelYDimension
      • xmp:ThumbnailsWidth
      • xmp:ThumbnailsHeight
  • Retains and does not alter other metadata tags
  • Currently does not support updating MakerNotes metadata

More information about EXIF metadata is available at:

Installation

Requires Java 8 or later

You can download source from the releases page

Alternatively, you can install the library via its Maven package

<dependency>
    <groupId>com.domenicseccareccia</groupId>
    <artifactId>jpeg-autorotate</artifactId>
    <version>1.1.0</version>
</dependency>

Usage

The library will load an image by either a String file path, File or InputStream, apply rotation, update metadata and return the image as a byte array.

File Path

byte[] image = JpegAutorotate.rotate("path/to/directory");

File

byte[] image = JpegAutorotate.rotate(new File("path/to/directory"));

InputStream

byte[] image = JpegAutorotate.rotate(new FileInputStream(new File("path/to/directory")));

Error Handling

The library throws the following exceptions:

  • JpegAutorotateException
  • FileNotFoundException
    • Only thrown if loading image by either a String file path or File)

Contributing

Contributions are welcome and will be fully credited.

See CONTRIBUTING.md for information on how to contribute to JPEG Autorotate.

Credits

Libraries

This library uses the following libraries:

Logo

The JPEG Autorotate logo uses the following icons from Font Awesome, available under the Creative Commons Attribution 4.0 International License:

The following icon changes were made:

  • Stroke width decreased for all icons by 0.25
  • Detached arrows from sync-alt

Other

License

This code is under the Apache License v2

Versions

Version
1.1.0
1.0.1
1.0.0