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 4099296
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:24:56+00:00 2026-05-20T20:24:56+00:00

I have a ndarray with floats in it I want to save. I would

  • 0

I have a ndarray with floats in it I want to save. I would like to keep the values as float though. The only format I found that accepts saving float data is tiff. Doesn’t show the actual image however.

from Image import *
from numpy import *

img = random.random((300, 300)) #float numbers, i have actual data in my image though
img = fromarray(img)
img.save('test.tiff')
  • 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-20T20:24:56+00:00Added an answer on May 20, 2026 at 8:24 pm

    Your example is saving a floating-point TIFF file. I’ve confirmed by examining the TIFF header, noting that the samples per pixel tag 0x153 has a value of 3 (floating point data). Using your example:

    import Image
    from numpy import *
    
    data = random.random((2, 2))
    img1 = Image.fromarray(data)
    img1.save('test.tiff')
    img2 = Image.open('test.tiff')
    
    f1 = list(img1.getdata())
    f2 = list(img2.getdata())
    print f1 == f2
    print f1
    

    Output:

    True
    [0.27724304795265198, 0.12728925049304962, 0.4138914942741394, 0.57919681072235107]
    

    Details on the TIFF6 file format

    Updated: Example 64×64 image viewed on Mac desktop:
    enter image description here

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

Sidebar

Related Questions

I have an function that maps an ndarray of shape (3) to a float,
I have a float pointer array and I would like to convert it to
I have a python ndarray temp in some code I'm reading that suffers this:
I have NSArray and I want to remove duplicates from it. I know that
I have an NSArray of Foos in an Objective-C program. I would like to
I have an NSArray of NSDictionary objects which I would like to be able
Let's say you have a float 5.9476386 and an NSArray with the floats 1,4,8,12,...
I have an AVURLAsset with multiple AVAssetTracks of type audio. I would like to
For example, I have a ndarray that is: a = np.array([1, 3, 5, 7,
I have a numpy.ndarray like this: array([[ 11.18033989, 0. ], [ 8.24621125, 3. ],

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.