2012-03-13 91 views
1

我正在尝试做一些事情:http://instaprint.me/,但是我没有专用的Linux机器,无纸化纸张和WiFi。另一方面,我的桌面连接到互联网和彩色照片打印机。从处理打印画布

所以,我脑子里想的是这样的 -

  1. 建立一个Instagram的API应用可以得到所有最新的照片
  2. 一个PHP脚本和一个服务器可以产生一个静态的URL信息对于带有header("Content-Type: image/jpeg")的最新照片,以便每次拍摄新照片时,该静态页面上的图像内容都会变为最近的照片。
  3. 其他页面(如上面提到的那个页面)会发生变化,以反映我拍摄的每张照片的新位置和标题,并将其置于静态URL上。
  4. 加工的一些基本知识。

因此,这里是如何对我这么远 - 我可以下载最新的带照片的身份证,如果它,因为它检查(15秒前)最后一次改变的话,就继续下载最最近的图像,标题和位置。

然后我可以把它们安排在画布上看起来像一个老式的宝丽来。现在我唯一要做的就是在150dpi的一张6x4in​​照片纸上打印画布。

任何人都知道我该如何做到这一点?

回答

1

专注于在Processing中创建大图像的部分,我做了一个Google搜索,想出了this thread。引用他们的问题和结果:

目标是打印一个180 pdi图像,其形状取决于 原始画布。所以可以是不同的,但它最终会成为大约1500x1000mm的 图片。所以一个大的形象。我不想 显示它只是为了将其转储到一个文件。

然后我设置了一个64位的JVM。最新的一个来自Oracle网站。然后我 创建不同大小的图片并将内存推到1024MB。 5000x7500测试OK6000x9000测试OK

我试图安装的内存高达1500MB,但JVM无法启动。 所以,我想1200MB 8000x12000测试OK

所以也没有做图像印刷的一部分,但它带来了上通过Java虚拟机(JVM)在内存越来越大图片关键信息。


最后,this thread描述了一种用于观看/打印大量使用OpenGL像素的TileSaver类。我在下面粘贴了一个大码块。 (这可能与您的问题无关,但会让其他用途的答案更完整。)

import processing.opengl.*; 
import toxi.geom.*; 
Tiler tiler; 

void setup() { 
    size(640,480,OPENGL); 
    tiler=new Tiler((PGraphics3D)g,NUM_TILES); 
} 

void draw() { 
    // see thread 
} 


/** 
* Implements a screen tile exporter with support for FOV, 
* clip planes and flexible file formats. 
* 
* Re-engineered from an older version by Marius Watz: 
* http://workshop.evolutionzone.com/unlekkerlib/ 
* 
* @author toxi <info at postspectacular dot com> 
*/ 
class Tiler { 
    protected PGraphics3D gfx; 
    protected PImage buffer; 
    protected Vec2D[] tileOffsets; 
    protected double top; 
    protected double bottom; 
    protected double left; 
    protected double right; 
    protected Vec2D tileSize; 

    protected int numTiles; 
    protected int tileID; 
    protected float subTileID; 

    protected boolean isTiling; 
    protected String fileName; 
    protected String format; 
    protected double cameraFOV; 
    protected double cameraFar; 
    protected double cameraNear; 

    public Tiler(PGraphics3D g, int n) { 
    gfx = g; 
    numTiles = n; 
    } 

    public void chooseTile(int id) { 
    Vec2D o = tileOffsets[id]; 
    gfx.frustum(o.x, o.x + tileSize.x, o.y, o.y + tileSize.y, 
    (float) cameraNear, (float) cameraFar); 
    } 

    public void initTiles(float fov, float near, float far) { 
    tileOffsets = new Vec2D[numTiles * numTiles]; 
    double aspect = (double) gfx.width/gfx.height; 
    cameraFOV = fov; 
    cameraNear = near; 
    cameraFar = far; 
    top = Math.tan(cameraFOV * 0.5) * cameraNear; 
    bottom = -top; 
    left = aspect * bottom; 
    right = aspect * top; 
    int idx = 0; 
    tileSize = new Vec2D((float) (2 * right/numTiles), (float) (2 * top/numTiles)); 
    double y = top - tileSize.y; 
    while (idx < tileOffsets.length) { 
    double x = left; 
    for (int xi = 0; xi < numTiles; xi++) { 
     tileOffsets[idx++] = new Vec2D((float) x, (float) y); 
     x += tileSize.x; 
    } 
    y -= tileSize.y; 
    } 
    } 

    public void post() { 
    if (isTiling) { 
    subTileID += 0.5; 
    if (subTileID > 1) { 
     int x = tileID % numTiles; 
     int y = tileID/numTiles; 
     gfx.loadPixels(); 
     buffer.set(x * gfx.width, y * gfx.height, gfx); 
     if (tileID == tileOffsets.length - 1) { 
     buffer.save(fileName + "_" + buffer.width + "x" 
     + buffer.height + "." + format); 
     buffer = null; 
     } 
     subTileID = 0; 
     isTiling = (++tileID < tileOffsets.length); 
    } 
    } 
    } 

    public void pre() { 
    if (isTiling) { 
    chooseTile(tileID); 
    } 
    } 

    public void save(String path, String baseName, String format) { 
    (new File(path)).mkdirs(); 
    this.fileName = path + "/" + baseName; 
    this.format = format; 
    buffer = new PImage(gfx.width * numTiles, gfx.height * numTiles); 
    tileID = 0; 
    subTileID = 0; 
    isTiling = true; 
    } 

    public boolean isTiling() { 
    return isTiling; 
    } 
}