Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:54:36+00:00 2026-05-15T01:54:36+00:00

I am making a Python script which will read in a GeoTIFF file, and

  • 0

I am making a Python script which will read in a GeoTIFF file, and will do both: convert the GeoTIFF into a static JPEG (that is much smaller in size), and create a separate text file which contains the GeoTIFF headers.

Using the Python GDAL API, I am able to get the script to open a GeoTIFF file, and print details, such as the RasterXSize, RasterYSize, RasterCount, etc.

The problem is with saving a JPEG. I have researched the driver.CreateCopy() method, however, all it does is create a very large JPEG file that is blank and can’t be opened.

Also, which method retrieves all of the GeoTIFF Headers that I can save to a file?

I’m neither an expert on GeoTIFFs nor GDAL, and I greatly appreciate the assistance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:54:37+00:00Added an answer on May 15, 2026 at 1:54 am

    I figured it out myself with some Googling.

    To save the .jpg file with varying level of quality, you need to use the following code:

    # Assume this retrieves the dataset from a GeoTIFF file.
    dataset = getDataSet(tiffFileLocation)      
    
    saveOptions = []
    saveOptions.append("QUALITY=75")
    
    # Obtains a JPEG GDAL driver
    jpegDriver = gdal.GetDriverByName("JPEG")   
    
    # Create the .JPG file
    jpegDriver.CreateCopy("imageFile.jpg", dataset, 0, saveOptions)  
    

    The parameters I need are stored in both the theDataset.GetGeoTransform(), and the theDataset.GetProjection() methods.

    Special thanks to this site: http://adventuresindevelopment.blogspot.com/2008/12/python-gdal-set-jpeg-quality-values-and.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a python script that should zip a file and upload it at
I am making a python script that in the case of EXT filesystem, will
I am trying to learn python and am making a program that will output
I am making a python script that suggests new music to you, but for
In Alex Martelli's response to Making a Python script Object-Oriented , he mentions that
I'm doing a bit of an experiment in Python. I'm making a script which
I'm looking for a cross-platform way of making my Python script process a file's
I'm writing a python script that takes a file one at a time or
I'm making a Python script that verifies if a Wikipedia link chain is valid.
I have a python script that reads from a config file. The config file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.