From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/75065 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: random background picture in metafun Date: Tue, 13 Mar 2012 11:58:52 -0400 (EDT) Message-ID: References: <4F5F5DA1.1050202@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1331654323 13086 80.91.229.3 (13 Mar 2012 15:58:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Mar 2012 15:58:43 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 13 16:58:41 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S7U7U-0007bC-T3 for gctc-ntg-context-518@m.gmane.org; Tue, 13 Mar 2012 16:58:40 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AAE4ACB2A9; Tue, 13 Mar 2012 16:58:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id C3k-0dkO8x4P; Tue, 13 Mar 2012 16:58:30 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6DE03CB291; Tue, 13 Mar 2012 16:58:30 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9D550CB291 for ; Tue, 13 Mar 2012 16:58:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wyyCWKmpN0to for ; Tue, 13 Mar 2012 16:58:10 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id E5356CB04D for ; Tue, 13 Mar 2012 16:58:10 +0100 (CET) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id q2DFw86V028047 for ; Tue, 13 Mar 2012 16:58:09 +0100 Original-Received: FROM LP533.ECE.McGill.CA (Mismatch [132.206.69.142]) By hellskitchen.mr.itd.umich.edu ID 4F5F6E8F.1AE92.12995 ; Authuser adityam; 13 Mar 2012 11:58:07 EDT In-Reply-To: <4F5F5DA1.1050202@uni-bonn.de> User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.14.82; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0QGJ3W89q - ed948fe801b1 - 20120313 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:75065 Archived-At: > Hi all, > > scenario: for a presentation, I want the background to be a random picture, > taken from a directory "backgroundpics." The pictures are numbered > consecutively as 1.jpg through 22.jpg. For some complex reasons, it would be > easier for me to include these pictures via metafun (I want to add other > graphical elements on top). So my question is, how can I pick a random > picture? Given the code > > StartPage ; > draw externalfigure "backgoundpics/1" xscaled PaperWidth yscaled > PaperHeight ; > StopPage ; > > how can I obtain a random number and make metapost pick the corresponding > picture? Sorry, difficult to make a minimal example here... (Untested) draw externalfigure ("backgroundpics/" & round(uniformdeviate(22)+1)) Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________