Author Topic: "bad jpg file" error  (Read 2290 times)

Ace

  • Autococker
  • Posts: 661
"bad jpg file" error
« on: November 15, 2013, 02:47:35 AM »
**edit** If I take the jpgs and save them again in paint or wally, they work fine, its the photoshop saving that's causing a problem, but I just don't know what that issue is, and would be nice to figure out, but not really needed anymore, unless someone wants to look into it.

Multiple question kind of day I guess.

This one is from creating some textures in photoshop/wally. My process is this:

1) Create the texture in PS, save to web, jpg. (256x256px, 72dpi) (64x64px, 72dpi)
2) Open in wally, convert to .wal

The process gives me a 256x, 64x, and .wal. But when I add them into directories, and try to play them in a map, it gives me a "bad jpg file" error. My directories are:

256x: E:\Paintball2\pball\textures\acetxts1
64x: E:\Paintball2\pball\textures\acetxts1\hr4
.wal: E:\bsp\pball2\quake2\pball\textures\acetxts1

I checked to see if it would do it with other textures in the same directories, and it did not. Compared my jpgs to the pball folder jpgs, seem to be the same. For reference, here's two jpgs, "test" works, "name" does not, but seem to be the same qualities. I also took "test" and ran it through PS, and just saved it as a jpg without changing anything else, and it did not work after that.

Photo Forensics data on both is the last image. Nothing really sticks out to me. Meh.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: "bad jpg file" error
« Reply #1 on: November 15, 2013, 03:15:09 PM »
The JPG library I'm using probably doesn't support something about those jpegs.  I know it doesn't work with black and white jpegs.  I'll have to debug it and see.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: "bad jpg file" error
« Reply #2 on: December 11, 2013, 12:28:06 PM »
I took a look at the file, and it looks like it's using EXIF compression instead of the normal JFIF jpeg compression.

Ace

  • Autococker
  • Posts: 661
Re: "bad jpg file" error
« Reply #3 on: December 11, 2013, 12:59:07 PM »
Good find, I'll look through the setting on photoshop, and see if it's changeable.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: "bad jpg file" error
« Reply #4 on: December 11, 2013, 01:38:57 PM »
Looks like the jpeg library supports it, but there's some code that checks if it's a valid jpg before trying to decompress it.  I'm trying to add proper header checking for the next version.

Ace

  • Autococker
  • Posts: 661
Re: "bad jpg file" error
« Reply #5 on: December 11, 2013, 06:09:47 PM »
In the mean time, if anyone is wondering, easiest fix is opening the EXIF compressed image in paint or wally and re-saving.

jitspoe

  • Administrator
  • Autococker
  • Posts: 18802
Re: "bad jpg file" error
« Reply #6 on: December 11, 2013, 09:45:56 PM »
Well, I have a fix, but sourceforge CVS doesn't want to respond to my commit right now for some reason... in any case, it should be fixed for the next build.

Also, I would not recommend compressing with EXIF, then recompressing with JFIF.  You're going to lose a lot of quality.  It would be better to export with something like PNG or TGA, then recompress with JPEG JFIF in another program, if you can't do it directly from photoshop.