ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* "*.jpg is bugged", previously working
@ 2021-09-01 17:22 Henning Hraban Ramm via ntg-context
  2021-09-01 18:24 ` Hans Hagen via ntg-context
  2021-09-01 21:50 ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 6+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2021-09-01 17:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

Hi again,

was something changed WRT JPEG images?

Since a few versions some images that used to work are denied with the error message "... is bugged".

Maybe there *is* something wrong with them, but I don’t see a problem.

"file" gives:

JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, height=3408, bps=0, PhotometricIntepretation=RGB, orientation=upper-left, width=2368], baseline, precision 8, 607x420, components 3

JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=9, manufacturer=FLIR Systems AB, model=FLIR ONE Pro, orientation=upper-left, xresolution=152, yresolution=160, resolutionunit=2, software=Common_dll v1.0.0b1, datetime=2021:08:03 15:28:27], baseline, precision 8, 640x480, components 3

The latter is one of Harald’s infrared pictures.

I can send them off-list, if you like.

Hraban
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "*.jpg is bugged", previously working
  2021-09-01 17:22 "*.jpg is bugged", previously working Henning Hraban Ramm via ntg-context
@ 2021-09-01 18:24 ` Hans Hagen via ntg-context
  2021-09-01 21:50 ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-09-01 18:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 9/1/2021 7:22 PM, Henning Hraban Ramm via ntg-context wrote:
> Hi again,
> 
> was something changed WRT JPEG images?
> 
> Since a few versions some images that used to work are denied with the error message "... is bugged".
> 
> Maybe there *is* something wrong with them, but I don’t see a problem.
> 
> "file" gives:
> 
> JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, height=3408, bps=0, PhotometricIntepretation=RGB, orientation=upper-left, width=2368], baseline, precision 8, 607x420, components 3
> 
> JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=9, manufacturer=FLIR Systems AB, model=FLIR ONE Pro, orientation=upper-left, xresolution=152, yresolution=160, resolutionunit=2, software=Common_dll v1.0.0b1, datetime=2021:08:03 15:28:27], baseline, precision 8, 640x480, components 3
> 
> The latter is one of Harald’s infrared pictures.
> 
> I can send them off-list, if you like.
well, we cannot dump that image from wet memory so ...

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "*.jpg is bugged", previously working
  2021-09-01 17:22 "*.jpg is bugged", previously working Henning Hraban Ramm via ntg-context
  2021-09-01 18:24 ` Hans Hagen via ntg-context
@ 2021-09-01 21:50 ` Hans Hagen via ntg-context
  2021-09-01 22:10   ` Henning Hraban Ramm via ntg-context
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-09-01 21:50 UTC (permalink / raw)
  To: Henning Hraban Ramm via ntg-context; +Cc: Hans Hagen

On 9/1/2021 7:22 PM, Henning Hraban Ramm via ntg-context wrote:
> Hi again,
> 
> was something changed WRT JPEG images?
> 
> Since a few versions some images that used to work are denied with the error message "... is bugged".
> 
> Maybe there *is* something wrong with them, but I don’t see a problem.
> 
> "file" gives:
> 
> JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, height=3408, bps=0, PhotometricIntepretation=RGB, orientation=upper-left, width=2368], baseline, precision 8, 607x420, components 3
> 
> JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=9, manufacturer=FLIR Systems AB, model=FLIR ONE Pro, orientation=upper-left, xresolution=152, yresolution=160, resolutionunit=2, software=Common_dll v1.0.0b1, datetime=2021:08:03 15:28:27], baseline, precision 8, 640x480, components 3
> 
> The latter is one of Harald’s infrared pictures.
> 
> I can send them off-list, if you like.

\starttext
     \externalfigure[20200910T115319.JPG][height=4cm]
     \externalfigure[old-paper-1140627-638x420.jpg][height=4cm]
\stoptext

both show up ok

(fwiw: the jpg code didn't really change since the first release of lmtx)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "*.jpg is bugged", previously working
  2021-09-01 21:50 ` Hans Hagen via ntg-context
@ 2021-09-01 22:10   ` Henning Hraban Ramm via ntg-context
  2021-09-02  7:27     ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2021-09-01 22:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm

[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]


> Am 01.09.2021 um 23:50 schrieb Hans Hagen via ntg-context <ntg-context@ntg.nl>:
> 
> On 9/1/2021 7:22 PM, Henning Hraban Ramm via ntg-context wrote:
>> Hi again,
>> was something changed WRT JPEG images?
>> Since a few versions some images that used to work are denied with the error message "... is bugged".
>> Maybe there *is* something wrong with them, but I don’t see a problem.
>> "file" gives:
>> JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=12, height=3408, bps=0, PhotometricIntepretation=RGB, orientation=upper-left, width=2368], baseline, precision 8, 607x420, components 3
>> JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=9, manufacturer=FLIR Systems AB, model=FLIR ONE Pro, orientation=upper-left, xresolution=152, yresolution=160, resolutionunit=2, software=Common_dll v1.0.0b1, datetime=2021:08:03 15:28:27], baseline, precision 8, 640x480, components 3
>> The latter is one of Harald’s infrared pictures.
>> I can send them off-list, if you like.
> 
> \starttext
>    \externalfigure[20200910T115319.JPG][height=4cm]
>    \externalfigure[old-paper-1140627-638x420.jpg][height=4cm]
> \stoptext
> 
> both show up ok
> 
> (fwiw: the jpg code didn't really change since the first release of lmtx)

It’s a problem with grph-downsample.lua (or maybe GM), I must research further...

\loadluafile[grph-downsample]

\setupexternalfigures[
  conversion=lowres.jpg,
	resolution=72,
]

\starttext
  \externalfigure[20200910T115319][height=4cm]
  \externalfigure[old-paper-1140627-638x420][height=4cm]
\stoptext


Hraban


[-- Attachment #2: grph-downsample.lua --]
[-- Type: application/octet-stream, Size: 2859 bytes --]

if not modules then modules = { } end modules ['grph-downsample'] = {
  version   = 1.100,
  comment   = "companion to grph-inc.mkiv",
  author    = "Peter Münster", -- adapted to LMTX by Hraban
  copyright = "PRAGMA ADE / ConTeXt Development Team",
  license   = "see context related readme files"
}

assert(not figures.getinfo2)

figures.getinfo2 = function(name, page) -- [ [NTG-context] Pdf info with Lua/Ctx API ]
 if type(name) == "string" then
   name = { name = name, page = page }
 end

 if name.name then
   local data = figures.push(name)
   local info = figures.identify()

   if info.status.status ~= 0 then
     figures.check() -- !Counts pages here!
   end

   figures.pop()

   return --data
          info
 end
end


local format = string.format
-- figures.cachepaths.path = "cache" -- should be setup-option
local function sample_down(oldname, newname, resolution)
  print("DOWNSAMPLE sample_down " .. oldname .. " to " .. newname)
  local request = figures.current().request
  local width = request.width
  local height = request.height
  if resolution == "" then -- or (not width and not height) then
    print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %s x %s px", oldname, newname, resolution, width, height))
    return
  end
  local TEXpt = 65536
  local inch = 72.27

  -- MkIV:
  -- local image = img.scan{filename = oldname}

  -- LMTX:
  local image = figures.getinfo(oldname,1)
  image = image.status.private

  local xy = image.xsize / image.ysize
  if (not width and not height) then
    -- no size requested? use default width
    width = 300 * TEXpt
  end
  if not width then
    height = height / TEXpt
    width = height * xy
  end
  if not height then
    width = width / TEXpt
    height = width / xy
  end
  width = math.floor(width)
  height = math.floor(height)
  print(format("DOWNSAMPLE image size %dx%dpx. requested %dx%d?", image.xsize, image.ysize, width, height))
  local xsize = math.floor(resolution * width / inch)
  local ysize = math.floor(resolution * height / inch)
  print(format("DOWNSAMPLE size %d x %d to %d x %d", image.xsize, image.ysize, xsize, ysize))
  if xsize < image.xsize or ysize < image.ysize then
    local s = format("gm convert -resize %dx%d -resample %dx%d %s %s",
                     xsize, ysize, resolution, resolution, oldname, newname)
    print("DOWNSAMPLE Conversion: " .. s)
    os.execute(s)
  else
    print(format("DOWNSAMPLE Nothing to do: %s, %s, %s dpi, %d x %d px", oldname, newname, resolution, width, height))
    print(format("DOWNSAMPLE xsize = %d, ysize = %d", xsize, ysize))
  end
end

local formats = {"png", "jpg", "gif"}

for _, s in ipairs(formats) do
  figures.converters[s] = figures.converters[s] or {}
  figures.converters[s]["lowres." .. s] = sample_down
end

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "*.jpg is bugged", previously working
  2021-09-01 22:10   ` Henning Hraban Ramm via ntg-context
@ 2021-09-02  7:27     ` Hans Hagen via ntg-context
  2021-09-02  8:11       ` Henning Hraban Ramm via ntg-context
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen via ntg-context @ 2021-09-02  7:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 9/2/2021 12:10 AM, Henning Hraban Ramm via ntg-context wrote:

> It’s a problem with grph-downsample.lua (or maybe GM), I must research further...
gm .. gs .. etc .. always keep the version that works when updating (I 
think my gm is very old by now .. one seldom need the latest greatest 
conversion features)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: "*.jpg is bugged", previously working
  2021-09-02  7:27     ` Hans Hagen via ntg-context
@ 2021-09-02  8:11       ` Henning Hraban Ramm via ntg-context
  0 siblings, 0 replies; 6+ messages in thread
From: Henning Hraban Ramm via ntg-context @ 2021-09-02  8:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm



> Am 02.09.2021 um 09:27 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 9/2/2021 12:10 AM, Henning Hraban Ramm via ntg-context wrote:
> 
>> It’s a problem with grph-downsample.lua (or maybe GM), I must research further...
> gm .. gs .. etc .. always keep the version that works when updating (I think my gm is very old by now .. one seldom need the latest greatest conversion features)

I install all these programs with MacPorts and update them frequently, it’s like a Linux distribution...

HR
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-02  8:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 17:22 "*.jpg is bugged", previously working Henning Hraban Ramm via ntg-context
2021-09-01 18:24 ` Hans Hagen via ntg-context
2021-09-01 21:50 ` Hans Hagen via ntg-context
2021-09-01 22:10   ` Henning Hraban Ramm via ntg-context
2021-09-02  7:27     ` Hans Hagen via ntg-context
2021-09-02  8:11       ` Henning Hraban Ramm via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).