tiff to jpg

Convert TIFF to JPG using REST API

TIFF (Tagged Image File Format) is popular for high-quality image storage, often used in fields requiring detailed visuals, like medical imaging or professional photography. However, TIFF files are large and may not be compatible with standard web applications. Converting TIFF to JPG (JPEG) offers a smaller file size with widespread compatibility across devices and platforms. This article explains how to convert TIFF images to JPG format using Java Cloud SDK with the robust capabilities of Cloud SDK, ensuring quick and efficient image transformation without compromising quality.

TIFF to JPG Conversion API

Aspose.Imaging Cloud SDK for Java provides powerful, easy-to-use tools for seamless image conversions. With Aspose.Imaging Cloud, you can adjust resolution, compression settings, and quality parameters to suit specific needs, delivering output optimized for digital viewing and storage.

  • The SDK makes integration smooth for developers, ensuring TIFF images are transformed efficiently, maintaining essential details, and reducing file sizes.

Firstly, we need to add the SDK reference in our java project by including following information in pom.xml of maven build type project.

<repositories> 
    <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>https://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>

<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-imaging-cloud</artifactId>
        <version>23.5</version>
    </dependency>
</dependencies>

Now, obtain your personalized Client ID and Client Secret details from Cloud dashboard. In case you do not have an access, simply sign up for a Free Trial using a valid email address over Aspose Cloud Dashboard.

Convert TIFF to JPG in Java

Let’s explore the details on how our Java Cloud SDK offers the flexibility to convert images with high performance and precision within Java application.

ImagingApi imageApi = new ImagingApi(clientSecret, clientId);

Create an instance of ImagingApi based on personalized client credentials.

File file1 = new File("C:\\Users\\nayyer\\Downloads\\input.tiff");
byte[] imageStream = Files.readAllBytes(file1.toPath());

Read the input TIFF image into byte array.

imageApi.uploadFile(uploadRequest);

Upload the input TIFF image to cloud storage.

ConvertImageRequest convertImage = new ConvertImageRequest("input.tiff", "jpg", null, null);

Create an object of ConvertImageRequest class where we specify the output format as JPG.

byte[] resultantImage = imageApi.convertImage(convertImage);

Finally, call the TIFF to JPG conversion API, which returns the resultant JPG image in byte array.

tiff to jpeg

A preview of TIFF file to JPG conversion.

Transfer TIFF to JPG using cURL Commands

For users who prefer a command-line interface, Aspose.Imaging Cloud also supports TIFF to JPEG conversion through simple cURL commands. This approach is beneficial for quick, server-side batch processing or automated image management tasks. Here’s how to achieve this:

Authenticate – Start by obtaining an access token to authenticate API requests:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=XXXXXX-XXXXXX-XXXXX-be35-ff5c3a6aa4a2&client_secret=XXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once we have the JWT access token, please call CreateConvertedImage API to transfer TIFF file to JPG format. We are using -o parameter to save the resultant JPG on local drive.

curl -v "https://api.aspose.cloud/v3.0/imaging/{sourceFile}/convert?format=jpg" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}"
- o "myResultant"

Replace sourceFile with the name of input TIFF image available in cloud storage, myResultant with the name of output JPG image and accessToken with the name of bearer token generated above.

Free TIFF File to JPEG Converter

In order to witness the amazing capabilities of Aspose.Imaging Cloud SDK, you may consider using our lightweight and super efficient TIFF to JPEG converter. This application is built on top of REST API, and can easily be accessed within a web browser.

tiff to jpeg

A preview of TIFF file to JPEG Converter App.

Conclusion

Converting TIFF images to JPG using Aspose.Imaging Cloud SDK for Java or cURL commands provides an efficient solution for handling high-resolution TIFF files. Whether you need compact files for web usage or want to automate image processing tasks, this API-driven approach offers flexibility, speed, and quality control. Start leveraging the power of Aspose.Imaging Cloud to make TIFF to JPG conversion seamless and enhance the way you manage and deliver image content across applications.

Please visit the following links to learn more about: