Page MenuHomePhabricator

Zero pixel JPEGs: Convert JPG files that start with a number of zero bytes (0xFF) to normal files
Open, LowPublic

Description

From http://commons.wikimedia.org/w/index.php?title=Commons:Village_pump&oldid=75879251#Zero_pixel_JPEGs

SELECT img_name
FROM image
WHERE (img_width = 0 OR img_height = 0)

AND img_major_mime="image" AND img_minor_mime="jpeg";

File:1753 Van Keulen Maldives Map.jpg
File:2011-12-16 Crucibulum laeve (Huds.- Relh) Kambly 189717.jpg
File:53 - Ipiales - Décembre 2008.jpg
File:83 - Cuzco - Juin 2009.jpg
File:Alte Hütte Neunkirchen.jpg
File:Austrocochlea porcata thin striped.jpg
File:Black Orchid.jpg
File:Blue Boy, Exeter - geograph.org.uk - 590383.jpg
File:BrandonBing.jpeg
File:CAPITANIA MARITIMA.jpg
File:ClothPack04.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Ministry of Culture and National Patrimony Rules Sign.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Murus Dacicus-4.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs Close Up.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs and Drain-1.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs and Drain.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs and Drain Close Up-1.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs and Drain Close Up-2.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Stairs and Drain Close Up.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One-7.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One-8.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One Close Up-1.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One Close Up-2.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One Close Up-4.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House One Close Up.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two-1.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two-2.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two-6.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two-7.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-1.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-2.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-3.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-4.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-5.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-6.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail-7.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - Tower House Two Wall Detail.jpg
File:Costesti Cetatuie Dacian Fortress 2011 - UNESCO Sign.jpg
File:Euphorbia exigua subsp. merinoi Habito 2010 9 26 DehesaBoyaldePuertollano.jpg
File:Exploit-MS04-028.proof.jpg
File:Ft Pierce FL Fort Pierce Inlet SP path02.jpg
File:General de division français (1890). Le général Borson..jpg
File:Herensteeg 13-15.jpg
File:ICCVP (249).jpg
File:Inverness FL city hall01.jpg
File:Ipiales - Décembre 2008.jpg
File:Jardí de les Escultures de Barcelona - Pep Duran- Transparent, el paisatge.JPG
File:Jaromír Bosák, Žijeme Londýnem, Brno (05).jpg
File:Jaromír Bosák, Žijeme Londýnem, Brno (06).jpg
File:Jax FL Terminal POC side01.jpg
File:John Ment Studio Nov09.jpg
File:João Pina, Campeao Europeu 2011, -73kg.jpg
File:Juvenile flammulated owl.jpg
File:Kille 12 SV copy.jpg
File:Kloster Lorsch 06.jpg
File:Lako bodra.jpg
File:Leuzea conifera Habitat 2010-6-08 DehesaBoyalPuertollano.jpg
File:Leuzea conifera Habito 2010-6-08 DehesaBoyalPuertollano.jpg
File:Logo beb 16 small.jpg
File:Lotus corniculatus Habit 2009-8-15 CampodeCalatrava.jpg
File:Lotus corniculatus Habitus 2009-8-15 CampodeCalatrava.jpg
File:Malerstraße 1 Loschwitz 1.jpg
File:Muscat-Interior of Sultan Qaboos Grand Mosque (41).jpg
File:North PB FL A1A near MacArthur Beach SP north01.jpg
File:Orastie Ethnography Museum 2011 - Dacian Agriculture Sign.JPG
File:Orastie Ethnography Museum 2011 - Dacian Fortress.JPG
File:Orastie Ethnography Museum 2011 - Dacian Gold Koson Coins.JPG
File:Orastie Ethnography Museum 2011 - Dacian Jeweler Tools Sign.JPG
File:Orastie Ethnography Museum 2011 - Dacian Mandrel and Spiral Bracelet-2.JPG
File:Orastie Ethnography Museum 2011 - Dacian Mandrel and Spiral Bracelet.JPG
File:Orastie Ethnography Museum 2011 - Dacian Weapons Sign.JPG
File:Orastie Ethnography Museum 2011 - Dacian Woodworking Axes.JPG
File:Orastie Ethnography Museum 2011 - Model of a Dacian Polygonal Stable.JPG
File:Pensacola Blount bldg03.jpg
File:PetroTravelPlaza sign, Rochelle, IL.jpg
File:Restaurace U Kozičky B.jpg
File:Restaurace U Kozičky C.jpg
File:Rozestavěnost OD Fontána v Teplicích 9. března 2012 (exif údaj je špatný).jpg
File:Sparkmotorsports (box) Oct.jpg
File:St. Pete St Mary OLG Church10.jpg
File:Tedgilmore.jpg
File:The upper Ettrick valley - geograph.org.uk - 1547130.jpg
File:Toronto 1876.jpg
File:Trajan Diktynna and Curetes 2.jpg
File:Tribulus terrestris Habitus 2010-9-08 DehesaBoyaldePuertollano.jpg
File:US Navy 090530-M-1821C-015 Lt. Shawn Steinbarger, assigned to Electronic Attack Squadron (VAQ) 142, climbs into the cockpit of an EA-6B Prowler.jpg
File:US Navy 110829-N-KB563-253 Chief petty officer selects paddle a small boat at the San Diego Maritime Museum during a team-building event.jpg
File:US Navy 110829-N-OA833-003 U.S. Naval Academy midshipmen march through Tecumseh Court as they participate in a practice parade.jpg
File:Velký Javor - zařízení na vrcholu J.JPG
File:Wikimania 2011 Fruits during Tea 2.JPG
File:Willard Straight house 5 Av 94 St jeh.jpg
File:Wooden Church Birth of Virgin Mary in Ieud Deal 2011-3.jpg
File:Музей П.Тичини с. Піски.jpg
File:日本劇場 (札幌市).jpg
95 Files in 30 minutes. —Dispenser (talk) 21:06, 11 August 2012 (UTC)

Interesting. I spot-checked 4 or 5 of them and they all displayed just fine in Safari when downloading the original image, so there is data there. But obviously the Wiki software has issues with them. Not sure what the issues are, but they should be possible to fix somehow. Hmm... I downloaded one and I do get an error of "Corrupt JPEG data: 91 extraneous bytes before marker 0xed `Willard_Straight_house_5_Av_94_St_jeh.jpg'". But it can be converted to an image without the error. Not sure what the real issue is, or if it can be fixed losslessly. Carl Lindberg (talk) 21:27, 11 August 2012 (UTC)

I fixed File:Willard Straight house 5 Av 94 St jeh.jpg by using "jpegtran -copy all -perfect", which should be lossless. I do see it removed the offending 91 bytes, then added something or other as the filesize is a little bit bigger. But that should be a decent approach to fixing any which have the same type of error. Not sure what caused the issue; the 91 bytes were all zero bytes, and it was a ways into the file. Carl Lindberg (talk) 22:16, 11 August 2012 (UTC)


Version: unspecified
Severity: normal

Details

Reference
bz39301

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:46 AM
bzimport set Reference to bz39301.
bzimport added a subscriber: Unknown Object (MLST).

For reference, we use php's getimagesize.

What is this bug asking to be changed? Disallowing such files to be uploaded, making mediawiki not fail on such files, or something else?

(In reply to comment #1)

For reference, we use php's getimagesize.

What is this bug asking to be changed? Disallowing such files to be uploaded,
making mediawiki not fail on such files, or something else?

Presumably to not misreport the size, if possible.

Hmm, guess that is an upstream issue.

(In reply to comment #3)

Hmm, guess that is an upstream issue.

Could be, or it could be that the JPGs are being corrupted at some point. Or even that the script which calls getimagesize isn't working properly. Perhaps someone should try calling it again on these files?

(In reply to comment #1)

For reference, we use php's getimagesize.

What is this bug asking to be changed? Disallowing such files to be uploaded,
making mediawiki not fail on such files, or something else?

It seems that all these files start with a number of zero bytes. I am asking that Mediawiki detects such files and converts them losslessly to normal files.

(In reply to comment #5)

(In reply to comment #1)

For reference, we use php's getimagesize.

What is this bug asking to be changed? Disallowing such files to be uploaded,
making mediawiki not fail on such files, or something else?

It seems that all these files start with a number of zero bytes. I am asking
that Mediawiki detects such files and converts them losslessly to normal files.

That sounds familar. I haven't looked at the files in question, but from your description, sounds like bug 31588

or never mind, the padding character in jpeg's are 0xFF not 0x00 (Been a while since I did stuff involving the jpeg file format).

For anyone wondering what happened to the files: The Zero Pixel query was incorporated into the Wrong Extension weekly report in October 2013.