[NTG-context] error when using externalfigure
Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[ http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm ] \stoptext When I run the context, it prints: ! Dimension too large. system tex error on line 1 in file a.tex: Dimension too large ... 1 \starttext 2 \externalfigure[ http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm ] 3 \stoptext 4 \relocateexternalfigure ...d \foundexternalfigure \bgroup \box \foundexterna... l.1 \relocateexternalfigure \calculateexternalfigure ...ua {figures.include()} \ctxlua {figures.scale()}\... \dodoplaceexternalfigure ...[][#1][#2][#3][#4][#5] \dotagfigure \naturalvbox ... argument ...1295-5ZTynx-s.jpg][][width=26.5mm][] \fi \firstofoneargument #1-#1 Because I have several thousands pictures, it is impossible for me to correct them all. Is it somehow possible to run the context so that it ignores the problematic pictures? Thank you Pavel Dohnal ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On 11/26/2012 10:20 AM, Pavel Dohnal wrote: Hello, I have a big context source file which contains pictures from different sources.. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg%5D%5Bwidth=26.5mm] \stoptext When I run the context, it prints: ! Dimension too large. it all depends on the original ... how small is it? one pixel? one option is then to scale in two steps: \scale[width=26.5cm]{\externalfigure[...][width=1mm]} or so - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 The first value is off for TeX. -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
2012/11/26 Hans Hagen pra...@wxs.nl On 11/26/2012 10:20 AM, Pavel Dohnal wrote: Hello, I have a big context source file which contains pictures from different sources.. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-**locations-images.tripomatic.** com/img-poi1295-5ZTynx-s.jpg][**width=26.5mmhttp://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg%5D%5Bwidth=26.5mm ] \stoptext When I run the context, it prints: ! Dimension too large. it all depends on the original ... how small is it? one pixel? one option is then to scale in two steps: \scale[width=26.5cm]{\**externalfigure[...][width=1mm]**} or so --**--**- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl --**--**- Original file has width 240px and height 160px but no mather what I try: \scale[width=26.5cm]{\**externalfigure[...][width=1mm]**} \scale[width=26.5cm]{\**externalfigure[...][width=240mm]**} \scale[width=26.5cm]{\**externalfigure[...][width=240px]**} I got allways the same result with Dimension too large error message Pavel Dohnal ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On Mon, Nov 26, 2012 at 10:50 AM, Hans Hagen pra...@wxs.nl wrote: On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib Hm, I'm not sure. It's an image that could be correct, but TeX cannot manage it. It has 240x160 pixels and 1ppi, so it's 6,096 meters x 4,06400meters and 6 meters are too much for TeX (which still has its limits around 5meters) It's ok to print poster maybe, but then TeX is not the right tool. -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
2012/11/26 luigi scarso luigi.sca...@gmail.com: It has 240x160 pixels and 1ppi, so it's 6,096 meters x 4,06400meters I doubt that 1ppi is intended. :-) Best Martin ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
I can see the problem. Image has wrong information in its header. But what to do with it? As I mentioned before, I create context source by another script (PHP script) and php runs context. I have thousands of images so it is impossible to me every single image convert. But I created php gate which try convert images on the fly. When I try this particural image convert it gives me this image: http://cdn-images-squared.tripomatic.com/e46c68903d2c4445f05a0369578c17dd-270.jpg But after context runs this file it falls down with error message: !LuaTeX error: reading JPEG image failed (no JPEG header found) == Fatal error occurred, no output PDF file produced! mtx-context | fatal error: return code: 70 Which is even worse, because although the user gets bad PDF it contains some information. In this case there is no pdf created. I looked in gimp for something bad in this image, but it looks ok to me. So do you have any advice what to do? Thanks 2012/11/26 Martin Schröder mar...@oneiros.de 2012/11/26 luigi scarso luigi.sca...@gmail.com: It has 240x160 pixels and 1ppi, so it's 6,096 meters x 4,06400meters I doubt that 1ppi is intended. :-) Best Martin ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On Mon, Nov 26, 2012 at 11:40 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: I can see the problem. Image has wrong information in its header. But what to do with it? As I mentioned before, I create context source by another script (PHP script) and php runs context. I have thousands of images so it is impossible to me every single image convert. But I created php gate which try convert images on the fly. When I try this particural image convert it gives me this image: http://cdn-images-squared.tripomatic.com/e46c68903d2c4445f05a0369578c17dd-270.jpg But after context runs this file it falls down with error message: !LuaTeX error: reading JPEG image failed (no JPEG header found) == Fatal error occurred, no output PDF file produced! mtx-context | fatal error: return code: 70 Which is even worse, because although the user gets bad PDF it contains some information. In this case there is no pdf created. I looked in gimp for something bad in this image, but it looks ok to me. So do you have any advice what to do? Thanks no errors here for \starttext \externalfigure[e46c68903d2c4445f05a0369578c17dd-270.jpg][width=26.5mm] \externalfigure[e46c68903d2c4445f05a0369578c17dd-270.jpg]%[width=26.5mm] \externalfigure[http://cdn-images-squared.tripomatic.com/e46c68903d2c4445f05a0369578c17dd-270.jpg][width=26.5mm] \stoptext -- luigi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On 26 Nov 2012, at 11:41 , Pavel Dohnal pavel.doh...@twobits.cz , wrote: When I try this particural image convert it gives me this image: http://cdn-images-squared.tripomatic.com/e46c68903d2c4445f05a0369578c17dd-270.jpg But after context runs this file it falls down with error message: I have no idea what you are trying to make, but if you can see the picture on your screen and you make a screenshot, ConTeXt will process that without a problem. The problem is perhaps that its resolution is a bit low so that you are limited as far as its size of the picture is concerned. But 4x4 cm would give an acceptable result, I think. (I tested it and the result is quite OK.) Best regards, Robert Blackstone ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On 11/26/2012 11:00 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:50 AM, Hans Hagen pra...@wxs.nl wrote: On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib Hm, I'm not sure. It's an image that could be correct, but TeX cannot manage it. It has 240x160 pixels and 1ppi, so it's 6,096 meters x 4,06400meters and 6 meters are too much for TeX (which still has its limits around 5meters) It's ok to print poster maybe, but then TeX is not the right tool. yes, but the 1,1 resolution prevents us from doing anything useful, i.e. we could for instance have something if xresolution 72 then xresolution = 72 end but I'm not sure what the pdf backend will do as then the uses resolution for front and backend differ too much i'll add an overflow check but keep in mind that in that case scaling is bases on the limited size - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
This seems to me a case of garbage in, garbage out; I'd say it's the script's job, rather than ConTeXt's, to ensure the images have the correct dpi to get a reasonable width in inches. (Brr. I hate inches. Disgusting, Mars-mission-wrecking way of measuring things.) Here is some pseudocode. You'd still need a way to get image.width_in_pixels and image.dpi from the image; I daresay either `convert` or `exiftool` can do the job. See also this recent mail to the list by Guy Stalnaker: http://archive.contextgarden.net/message/20121123.232556.bf205641.en.html projected_width = image.width_in_pixels / image.dpi if projected_width max_width_in_inches then required_dpi = image.width_in_pixels / max_width_in_inches shell('convert --density %f %s', required_dpi, image_name) end Cheers, Sietse On Mon, Nov 26, 2012 at 1:32 PM, Hans Hagen pra...@wxs.nl wrote: On 11/26/2012 11:00 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:50 AM, Hans Hagen pra...@wxs.nl wrote: On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: Hello, I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib Hm, I'm not sure. It's an image that could be correct, but TeX cannot manage it. It has 240x160 pixels and 1ppi, so it's 6,096 meters x 4,06400meters and 6 meters are too much for TeX (which still has its limits around 5meters) It's ok to print poster maybe, but then TeX is not the right tool. yes, but the 1,1 resolution prevents us from doing anything useful, i.e. we could for instance have something if xresolution 72 then xresolution = 72 end but I'm not sure what the pdf backend will do as then the uses resolution for front and backend differ too much i'll add an overflow check but keep in mind that in that case scaling is bases on the limited size - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___ ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On Mon, 26 Nov 2012, Hans Hagen wrote: On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext i just tried the minimal example here, it gives a valid PDF with a properly (afaics) scaled image. Creator:ConTeXt - 2012.11.26 13:31 Producer: LuaTeX-0.70.2 when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 tried, can't see here. The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib can't confirm. Is this solved already? Regards, Hartmut ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] error when using externalfigure
On 11/26/2012 8:54 PM, Dr. Hartmut Henkel wrote: On Mon, 26 Nov 2012, Hans Hagen wrote: On 11/26/2012 10:36 AM, luigi scarso wrote: On Mon, Nov 26, 2012 at 10:20 AM, Pavel Dohnal pavel.doh...@twobits.cz wrote: I have a big context source file which contains pictures from different sources. The problem is, that there are some pictures the context cannot process. It displays an error message and ends. I run the context from another script in batchmode. After finishing, the context creates a PDF file, which contains this problematic picture but the pdf is broken. It does not have numbers in the table of contents and it is not arranged by setup. Here is a minimal example: \starttext \externalfigure[http://cdn-locations-images.tripomatic.com/img-poi1295-5ZTynx-s.jpg][width=26.5mm] \stoptext i just tried the minimal example here, it gives a valid PDF with a properly (afaics) scaled image. Creator:ConTeXt - 2012.11.26 13:31 Producer: LuaTeX-0.70.2 when I save the jpg as eps from gimp I see width = 6096,00 height=4064,00 tried, can't see here. The first value is off for TeX. if i print the values from the img object i get 17344.8pt 11563.2pt so the problem is deep down in the jpg reader ... the image is crippled in the sense that it has no valid resolution information something for hartmut to check in the img lib can't confirm. Is this solved already? the latest beta clips ... something: local maxdimen = 2^30-1 function img.check(figure) if figure then local width = figure.width local height = figure.height if height width then if height maxdimen then figure.height = maxdimen figure.width = width * maxdimen/height end elseif width maxdimen then figure.width = maxdimen figure.height = height * maxdimen/width end return figure end end so it's taken care of (in principle the img library is right in handling maxdimen dimensions as lua has no such limit) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___