I just figured this out when your message came in.
Cheers! This really made my day
Sorry, Okay, I still haven't had my cup of coffee, but I actually
tried to make sure it would work, and It's SetOptionInt... anyway
here's what worked:
img = wx.EmptyImage(100,100,False)
img.SetOptionInt("Compression", 1)
img.SaveFile("/tmp/test.tif", wx.BITMAP_TYPE_TIF)
It turns out that neither compression 8 (deflate) or 6 (jpeg) is
enabled in the windows wxPython binaries either (brand new 2.6.1.0 on
XP.) For my own purposes in the project I'm doing I'm going to have
to substitute a more feature-complete version of libtiff.
(Setting False on the EmptyImage means "don't clear the image" and
shows uninitialized memory as fun patterns.)
-Jim
Oh, and wx_image_option_compression is really the string "Compression"
img.SetOption("Compression", 8) should do the trick.
Sorry, I need another cup of coffee, and to start actually reading
e-mails before I reply.
-Jim
> Sorry, I realized after I sent the e-mail that I was on the wxPython
> list, not wxWidgets itself.
>
> I don't see the COMPRESSION_NONE constant in a dir(wx), but here are
> the integers that you can use: (I'd stick to 1 for none, 7 for Jpeg,
> or 8 for deflate.)
>
> #define COMPRESSION_NONE 1 /* dump mode */
> #define COMPRESSION_CCITTRLE 2 /* CCITT modified
Huffman RLE */
> #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax
encoding */
> #define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6
name) */
> #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax
encoding */
> #define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6
name) */
> #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch
*/
> #define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
> #define COMPRESSION_JPEG 7 /* %JPEG DCT compression
*/
> #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
> #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment
*/
> #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
> #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
> /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT
<dkelly@apago.com) */
> #define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
> #define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
> #define COMPRESSION_IT8MP 32897 /* IT8 Monochrome
picture */
> #define COMPRESSION_IT8BL 32898 /* IT8 Binary line art
*/
> /* compression codes 32908-32911 are reserved for Pixar */
> #define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit
LZW */
> #define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit
ZIP */
> #define COMPRESSION_DEFLATE 32946 /* Deflate compression
*/
> #define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate
> compression, as recognized by Adobe */
*/
> #define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
> #define COMPRESSION_JBIG 34661 /* ISO JBIG */
> #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE
*/
> #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed
*/
>
>
> -Jim
>
>
> >
> > Ahaaa, I already hoped the SetOption would turn up with a surprise.
> > (The should better list these options in the Reference at wxImage::
... )
> >
> > Only 1 problem: COMPRESSION_NONE is not defined, "COMPRESSION_NONE" as
> > string does nothing...
> > I don't seem to find the right value for wxIMAGE_OPTION_COMPRESSION.
You
> > don't accidently have the proper value list?
> >
> >
> > Hi,
> >
> > For me the trick was to do:
> >
> > wxProgressDialog wait("Please Wait", "Saving image...", 3);
> > // progress bar will show one third of the way along
> > wait.Update(0);
> >
> > wxImage img = pBmp->ConvertToImage();
> > img.SetOption(wxIMAGE_OPTION_COMPRESSION, COMPRESSION_NONE);
> > img.SaveFile(absolutePath, (wxBitmapType)imageType);
> >
> > It works, but it does take several seconds... so that's why the
> > progress bar is there.
> >
> > -Jim
> >
> >
> > > in "Tiff LZW support?" James Caroll wrote:
> > >
> > >
> > > >> >> >> I do want to be able to save TIFF images with LZW support.
> > > >> >> >> In my app, when I try, I get an error messagebox reading,
"LZW
> > > >> >> >> compression is not available due to Unisys patent
enforcement."
> > >
> > > I didn't specify any compression (thus, neither LZW), but also get
the
> > same
> > > error...
> > >
> > > Is there any way to save tif's at the moment?
> > > Adobe Photoshop for ex uses 'none', 'zip' or 'jpeg' as alternative
> > > compression methods.
> > >
> > > Anyway, if it IS possible to save an wxImage as tif at the current
time
> > > being, could someone help me out?
> > > (and if it isn't could anybody enlighten me with a date?)
> > >
> > > Thanks!
> > >
> > >
> >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
> > > For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> > For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> > For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org
···
-----Original Message-----
From: James Carroll
On 6/22/05, James Carroll <mrmaple@gmail.com> wrote:
On 6/22/05, James Carroll <mrmaple@gmail.com> wrote:
> /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com>
> On 6/22/05, :. POLARIS Creative Backline _ Koen Betsens > > <koen@polarisnation.com> wrote:
> > On 6/22/05, :. POLARIS Creative Backline _ Koen Betsens > > > <koen@polarisnation.com> wrote:
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org