{"id":46,"date":"2008-07-04T11:59:39","date_gmt":"2008-07-04T09:59:39","guid":{"rendered":"http:\/\/unckel.com\/blog\/?p=46"},"modified":"2019-12-07T22:23:33","modified_gmt":"2019-12-07T21:23:33","slug":"photoshop-script-mehrere-bilder-formatabhaengig-in-ein-bild-zusammen-setzen","status":"publish","type":"post","link":"https:\/\/unckel.de\/blog\/photoshop-script-mehrere-bilder-formatabhaengig-in-ein-bild-zusammen-setzen\/","title":{"rendered":"Photoshop Script: Mehrere Bilder formatabh\u00e4ngig in ein Bild zusammen setzen"},"content":{"rendered":"<p>Setzt mehrere ge\u00f6ffnete Bilder in ein Bild zusammen, abh\u00e4ngig vom Format (breit\/hoch).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-47\" src=\"https:\/\/unckel.de\/blog\/wp-content\/uploads\/photoshop-script-two-in-one.jpg\" alt=\"\" width=\"384\" height=\"353\" \/><\/p>\n<pre>\/\/#####################################################################\n\/\/\n\/\/  Crop all open images and merge together in one image dependent size\n\/\/  Photoshop Script (CS2, tested on PC) \n\/\/\n\/\/#####################################################################\n\n\/\/ save the current preferences &amp; settings\nvar startRulerUnits = app.preferences.rulerUnits\nvar startTypeUnits = app.preferences.typeUnits\nvar startDisplayDialogs = app.displayDialogs\napp.preferences.rulerUnits = Units.PIXELS\napp.preferences.typeUnits = TypeUnits.PIXELS\napp.displayDialogs = DialogModes.NO\n\n\/\/ main script\nvar docs = app.documents;\nvar openDocs = docs.length;\n\n\/\/ crop all open images from border\nvar cropSize = prompt('Crop from border (in pixel).', '');\n\nfor (var i=0; i&lt;openDocs; i++) {\n\n\tapp.activeDocument = docs[i];\n\tapp.activeDocument.changeMode(ChangeMode.RGB);\n\n\t\/\/ don't crop if no value or image is smaller\n\tif (cropSize != '' &amp;&amp; cropSize &gt; 0 &amp;&amp; \n\t\tcropSize &lt; app.activeDocument.width &amp;&amp; \n\t\tcropSize &lt; app.activeDocument.height) { \n\t\t\tcropWidthFromBorder(cropSize);\n\t}\n}\n\n\/\/ resize canvas on first image dependent on image size\nvar pano;\napp.activeDocument = docs[0];\n\nif(app.activeDocument.width &gt; app.activeDocument.height) {\n\tpano = true;\n\tapp.activeDocument.resizeCanvas(app.activeDocument.width, \n\t\tapp.activeDocument.height * openDocs, AnchorPosition.TOPLEFT);\n}\nelse {\n\tpano = false;\n\tapp.activeDocument.resizeCanvas(app.activeDocument.width * openDocs, \n\t\tapp.activeDocument.height, AnchorPosition.TOPLEFT);\n}\n\n\/\/ put all images into first image\nfor (var j=1; j&lt;openDocs; j++) {\n\n\tapp.activeDocument = docs[j];\n\tapp.activeDocument.activeLayer.copy();\n\tapp.activeDocument = docs[0];\n\n\tif(pano) {\n\t\tsetSection(0, app.activeDocument.height\/2, \n\t\t\tapp.activeDocument.width, app.activeDocument.height);\n\t}\n\telse {\n\t\tsetSection(app.activeDocument.width\/2, 0, \n\t\t\tapp.activeDocument.width, app.activeDocument.height);\n\t}\n\n\tapp.activeDocument.paste();\n}\n\napp.activeDocument.flatten();\n\n\/\/ close all open images except the first\n\/\/if (confirm('Close all images except the first one?')) {\n\tfor (var x=1; x&lt;openDocs; x++) {\n\t\tdocs[x].close(SaveOptions.DONOTSAVECHANGES)\n\t}\n\/\/}\n\n\/\/ restore settings\napp.preferences.rulerUnits = startRulerUnits;\napp.preferences.typeUnits = startTypeUnits;\napp.displayDialogs = startDisplayDialogs;\n\n\/\/alert(\"Done!\");\n\n\/\/####################################################################\n\nfunction cropWidthFromBorder(cropWidth) { \n\tapp.activeDocument.crop(Array(cropWidth,\n\t\tcropWidth,\n\t\tapp.activeDocument.width - cropWidth,\n\t\tapp.activeDocument.height - cropWidth));\n}\n\nfunction setSection(left, top, width, height) {\n\tvar selRegion = Array(\n\t\tArray(left, top),\n\t\tArray(left + width, top),\n\t\tArray(left + width, top + height),\n\t\tArray(left, top + height),\n\t\tArray(left, top));\n\tapp.activeDocument.selection.select(selRegion);\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Setzt mehrere ge\u00f6ffnete Bilder in ein Bild zusammen, abh\u00e4ngig vom Format (breit\/hoch). \/\/##################################################################### \/\/ \/\/ Crop all open images and merge together in one image dependent size \/\/ Photoshop Script (CS2, tested on PC) \/\/ \/\/##################################################################### \/\/ save the current preferences &amp; settings var startRulerUnits = app.preferences.rulerUnits var startTypeUnits = app.preferences.typeUnits var startDisplayDialogs = app.displayDialogs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-adobe-photoshop"],"_links":{"self":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":828,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions\/828"}],"wp:attachment":[{"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unckel.de\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}