From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/103350 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Marco Patzer Newsgroups: gmane.comp.tex.context Subject: Re: degrade module Date: Fri, 15 Feb 2019 08:25:35 +0100 Message-ID: <20190215082535.39294102@homerow> References: <87lg2ikt6e.fsf@a16n.net> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/lqkaWpq=1/Cl4Ot1lnAbw+D" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260080"; mail-complaints-to="usenet@blaine.gmane.org" Cc: mailing list for ConTeXt users To: Lutz Haseloff Original-X-From: ntg-context-bounces@ntg.nl Fri Feb 15 08:29:01 2019 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1guXvh-0015Wo-M0 for gctc-ntg-context-518@m.gmane.org; Fri, 15 Feb 2019 08:29:01 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E6505EC69D; Fri, 15 Feb 2019 08:25:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nhNd9hjfv22i; Fri, 15 Feb 2019 08:25:42 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 305D1EC691; Fri, 15 Feb 2019 08:25:42 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B0DCEEC691 for ; Fri, 15 Feb 2019 08:25:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J9DOZFwCOtco for ; Fri, 15 Feb 2019 08:25:41 +0100 (CET) Original-Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 0D8B6EC68B for ; Fri, 15 Feb 2019 08:25:41 +0100 (CET) Original-Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 0AAB74AC243C; Fri, 15 Feb 2019 10:25:40 +0300 (MSK) Original-Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id eUQDcikNHx-PdMKxZni; Fri, 15 Feb 2019 10:25:40 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=homerow.info; s=mail; t=1550215540; bh=QeT+7tdtKVDQeLGhJ91eq1ts/ImhXKD0HtSV7+2Bxog=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References; b=cwsTIk3o5Db21Dbs3fitrCWZe9/YtMPbPIEeW1fO3A49sSP2utwCb8esqqhIz6lg0 5OboYAgfhiNNkcZNGXiBBEPSYSlPjP+V6HNUG/on3du/+2q6VdAlczISGwH3dlBBo1 8NT3P9FG9qz/gpbQwiQlGwOP1AnqifdPZBES235c= Authentication-Results: mxback10g.mail.yandex.net; dkim=pass header.i=@homerow.info Original-Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id NdMr6mc3tY-Pc44U1Ea; Fri, 15 Feb 2019 10:25:38 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) In-Reply-To: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:103350 Archived-At: --MP_/lqkaWpq=1/Cl4Ot1lnAbw+D Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, 15 Feb 2019 07:56:31 +0100 Lutz Haseloff wrote: > First i tried the grph-downsample.lua script. > Unfortunately i get an error message > grph-downsample.lua:31: bad argument #2 to 'format' (number has no > integer representation) See attached log file. I remember that error. The script worked up to a particular context version. I believe a Lua upgrade broke it. The version attached should work. Marco --MP_/lqkaWpq=1/Cl4Ot1lnAbw+D Content-Type: text/x-lua Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=t-downsample.lua if not modules then modules =3D { } end modules ['t-downsample'] =3D { version =3D 1.001, comment =3D "companion to grph-inc.mkiv", author =3D "Peter M=C3=BCnster", copyright =3D "PRAGMA ADE / ConTeXt Development Team", license =3D "see context related readme files" } local format =3D string.format -- figures.cachepaths.path =3D "cache" -- should be setup-option local function sample_down(oldname, newname, resolution) local request =3D figures.current().request local width =3D request.width local height =3D request.height if resolution =3D=3D "" or (not width and not height) then print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution)) return end local inch =3D 72.27 local image =3D img.scan{filename =3D oldname} local xy =3D image.xsize / image.ysize if not width then width =3D height * xy / 65536 end if not height then height =3D width / xy / 65536 end local xsize =3D resolution * width / inch local ysize =3D resolution * height / inch if xsize < image.xsize or ysize < image.ysize then local s =3D format("gm convert -strip -resize %dx%d %s %s", xsize, ysize, oldname, newname) print("Conversion: " .. s) os.execute(s) else print(format("Nothing to do: %s, %s, %s", oldname, newname, resolution)) print(format("xsize =3D %d, ysize =3D %d", xsize, ysize)) end end local formats =3D {"png", "jpg", "gif"} for _, s in ipairs(formats) do figures.converters[s] =3D figures.converters[s] or {} figures.converters[s]["lowres." .. s] =3D sample_down end --MP_/lqkaWpq=1/Cl4Ot1lnAbw+D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --MP_/lqkaWpq=1/Cl4Ot1lnAbw+D--