PIL.Image.frombuffer/string ... who do data using?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ivan.dm

    #1

    PIL.Image.frombuffer/string ... who do data using?

    hello again everyone!

    I'm writing a wrapper for tif file that parse its and return the data
    image in this way below :

    self.fp.seek(St ripOffsets)
    data = self.fp.read(St ripByteCounts)
    return data

    where:
    self.fp is a file object
    StripOffsets is a offset position of image
    StripByCounts is extend of image

    after we get a data, now to set its in PIL.Image.froms tring(...)
    but ( evely! :) ), returned this error follow:

    ValueError
    "not enough image data"

    why???

    Should I to convert data in other format???

    any suggestion?

    Thanks and regard.

    Ivan
  • Peter Hansen

    #2
    Re: PIL.Image.fromb uffer/string ... who do data using?

    ivan.dm wrote:[color=blue]
    > I'm writing a wrapper for tif file that parse its and return the data
    > image in this way below :
    >
    > self.fp.seek(St ripOffsets)
    > data = self.fp.read(St ripByteCounts)
    > return data[/color]
    ....[color=blue]
    > after we get a data, now to set its in PIL.Image.froms tring(...)
    > but ( evely! :) ), returned this error follow:
    >
    > ValueError
    > "not enough image data"[/color]

    Why are you doing it this way instead of just using Image.open()? PIL
    already knows how to read and convert TIFF images...

    -Peter

    Comment

    • ivan.dm

      #3
      Re: PIL.Image.fromb uffer/string ... who do data using?

      Peter Hansen ha scritto:[color=blue]
      > ivan.dm wrote:
      >[color=green]
      >> I'm writing a wrapper for tif file that parse its and return the data
      >> image in this way below :
      >>
      >> self.fp.seek(St ripOffsets)
      >> data = self.fp.read(St ripByteCounts)
      >> return data[/color]
      >
      > ...
      >[color=green]
      >> after we get a data, now to set its in PIL.Image.froms tring(...)
      >> but ( evely! :) ), returned this error follow:
      >>
      >> ValueError
      >> "not enough image data"[/color]
      >
      >
      > Why are you doing it this way instead of just using Image.open()? PIL
      > already knows how to read and convert TIFF images...
      >
      > -Peter
      >[/color]
      yes! for all format it can decode, except for compression G3/G4.
      I'm searching a method for decode this compression format

      Ivan

      Comment

      Working...