FoxPro Programming
Picture to big, corrupt, or in wrong format
Gravatar is a globally recognized avatar based on your email address. Picture to big, corrupt, or in wrong format
  Craig Tucker
  All
  Aug 16, 2017 @ 09:11am

Hi All, I am programatically running VFP job tickets and packing list that have image thumbnails on them generated from larger jpg files. I have literally used "CreateThumbNail()" in Rick's wwAPI class to create the smaller images. However, randomly I get the error "Picture to big, corrupt, or in the wrong format" error. Rerunning the same process against the same files always runs successfully. Has anyone else had this issue and what did you do to resolve? It stops production processes. Thanks much, Craig

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Michael Hogan (Ideate Hosting)
  Craig Tucker
  Aug 16, 2017 @ 01:17pm

Hi Craig.

Rick's tools are top notch - but for image processing, I use IrfanView - automating it from VFP using the RUN command. It's been a very successful approach. http://www.irfanview.com/

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Craig Tucker
  Michael Hogan (Ideate Hosting)
  Aug 16, 2017 @ 01:30pm

Thanks Michael, I don't think it's the image or image creation utility. In fact, I automated CorelDRAW to generate the same thumbnails and still get the same error (randomly). I am even flushing memory after each line item. It seems like a bug in the VFP report writer.

I would actually like to convert this to .net but don't want to spend $500+ for a simple report writer. Any suggestions on an inexpensive .net report writer appreciated too!

Thanks, Craig

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Rick Strahl
  Craig Tucker
  Aug 16, 2017 @ 05:20pm

Could your issue be concurrency? Are you making sure you're not overwriting the same files from multiple instances of your application?

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Craig Tucker
  Rick Strahl
  Aug 17, 2017 @ 06:49pm

Hi Rick, So I started digging deeper into the code to check for concurrency issues and realized the variable in the report was getting reset to the large format file... (thread of shame)... Thanks much, Craig

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Rick Strahl
  Craig Tucker
  Aug 18, 2017 @ 09:26am

What's a Large Format File in this context and why would that matter?

The main issue I'm referring to is that you might be writing out to the same file, at the same time and that will cause problems. Make sure images written always use unique names that you can clean up later because either multiple users or even the same user may trigger multiple requests to the same operation on a different thread.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Picture to big, corrupt, or in wrong format
  Craig Tucker
  Rick Strahl
  Aug 18, 2017 @ 09:47am

I was accidentally referencing original high resolution files (1-2mb) into the report instead of the thumbnail (3-5kb). There are sometimes 10-20 lineitems. Randomly, memory filled up (I presume) and as the error displayed "Picture too big...". I have also cleaned up the thumbnail routine to create unique names. Problem solved, we haven't had any more errors.

© 1996-2024