forked from processing-js/processing-js.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPImage_save_.html
More file actions
69 lines (65 loc) · 2.18 KB
/
Copy pathPImage_save_.html
File metadata and controls
69 lines (65 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
layout: default
---
<table cellpadding="0" cellspacing="0" border="0" class="ref-item">
<tr>
<th scope="row">Class</th>
<td>PImage</td>
</tr>
<tr class="name-row">
<th scope="row">Name</th>
<td><h3>save()</h3></td>
</tr>
<tr class="">
<th scope="row">Examples</th>
<td><div class="example"><pre class="">// @pjs preload must be used to preload the image
/* @pjs preload="tower.jpg"; */
PImage img = loadImage("tower.jpg");
img.save("img.jpg");</pre><hr />
<pre class="">// @pjs preload must be used to preload the image
/* @pjs preload="tower.jpg"; */
size(100, 100);
PImage img = loadImage("tower.jpg");
PImage newImg = createImage(100, 100, RGB);
newImg = img.get();
newImg.save("newImg.jpg");</pre>
</div>
</td>
</tr>
<tr class="">
<th scope="row">Description</th>
<td><p>Updates the image with the data in its <b>pixels[]</b> array. Use in conjunction with <b>loadPixels()</b>.
If you're only reading pixels from the array, there's no need to call <b>updatePixels()</b>. </p>
<p>Certain renderers may or may not seem to require <b>loadPixels()</b> or <b>updatePixels()</b>.
However, the rule is that any time you want to manipulate the <b>pixels[]</b> array, you must first call <b>loadPixels()</b>, and after changes have been made,
call <b>updatePixels()</b>. Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change.</p>
<p>Currently, none of the renderers use the additional parameters to <b>updatePixels()</b>, however this may be implemented in the future.</p></td>
</tr>
<tr class="">
<th scope="row">Syntax</th>
<td><pre><kbd>img</kbd>.save(<kbd>filename</kbd>)</pre><br /></td>
</tr>
<tr class="">
<th scope="row">Parameters</th>
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tr class="">
<th scope="row">img</th>
<td>PImage: any variable of type PImage</td>
</tr>
<tr class="">
<th scope="row">filename</th>
<td>String: a sequence of letters and numbers</td>
</tr>
</table>
</td>
</tr>
<tr class="">
<th scope="row">Returns</th>
<td>None</td>
</tr>
<tr class="">
<th scope="row">Usage</th>
<td>Web & Application</td>
</tr>
</table>