透過網頁讀取Photoshop PSD檔案內容
在專案中有需要透過網頁來讀取Photoshop PSD檔案的內部資訊,我們透過PSD.js(備用載點)來實現這樣的功能,在官方提供的功能展示頁中,我們可以看到在頁面中只需引入psd.min.js後,加入透過少量的Javascript就可以針對PSD進行解析。
<!DOCTYPE html> <html> <head> <title>psd.js image example</title> <style type="text/css"> body, html { padding: 0; margin: 0; } #dropzone { width: 500px; height: 100px; border: 1px #ababab dashed; margin: 50px auto; } #dropzone p { text-align: center; line-height: 100px; margin: 0; padding: 0; } #image { text-align: center; } </style> <script type="text/javascript" src="psd.min.js"></script> </head> <body> <div id="dropzone"> <p>Drop here</p> </div> <div id="image"></div> <pre id="data"></pre> <script type="text/javascript"> (function () { var PSD = require('psd'); document.getElementById('dropzone').addEventListener('dragover', onDragOver, true); document.getElementById('dropzone').addEventListener('drop', onDrop, true); function onDragOver(e) { e.stopPropagation(); e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; } function onDrop(e) { e.stopPropagation(); e.preventDefault(); PSD.fromEvent(e).then(function (psd) { var data = JSON.stringify(psd.tree().export(), undefined, 2); document.getElementById('data').innerHTML = data; document.getElementById('image').appendChild(psd.image.toPng()); }); } }()); </script> </body> </html>
我們透過下圖這樣的一個PSD檔案對頁面進行測試,檔案中共有三個圖層,包含一個文字圖層。
頁面將PSD分析出結果後,以json格式顯示在頁面上,可以看到文字圖層的部分,不僅能讀到圖層名稱也包含文字內容和字型名稱。
{ "children": [ { "type": "layer", "visible": true, "opacity": 1, "blendingMode": "normal", "name": "Photoshop Text", "left": 302, "right": 723, "top": 90, "bottom": 128, "height": 38, "width": 421, "mask": {}, "text": { "value": "THIS IS TEXT LAYER", "font": { "name": "MyriadPro-Regular\u0000", "sizes": [ 53 ], "colors": [ [ 0, 0, 0, 255 ] ], "alignment": [ "center" ] }, "left": 0, "top": 0, "right": 0, "bottom": 0, "transform": { "xx": 1, "xy": 0, "yx": 0, "yy": 1, "tx": 513, "ty": 127 } }, "image": {} }, { "type": "layer", "visible": true, "opacity": 1, "blendingMode": "normal", "name": "PSD Icon", "left": 287, "right": 738, "top": 209, "bottom": 669, "height": 460, "width": 451, "mask": {}, "image": {} }, { "type": "layer", "visible": true, "opacity": 1, "blendingMode": "normal", "name": "Background", "left": 0, "right": 1024, "top": 0, "bottom": 800, "height": 800, "width": 1024, "mask": {}, "image": {} } ], "document": { "width": 1024, "height": 800, "resources": { "layerComps": [], "guides": [], "slices": [] } } }
Можно ли купить аттестат о среднем образовании? Основные рекомендации
ast-diplomy24.ru/otzyvy
Добрый день!
Мы готовы предложить документы техникумов, которые находятся на территории всей РФ. Вы можете заказать качественно напечатанный диплом от любого учебного заведения, за любой год, в том числе документы старого образца СССР. Дипломы и аттестаты выпускаются на “правильной” бумаге самого высшего качества. Это позволяет делать настоящие дипломы, не отличимые от оригинала. Документы заверяются всеми требуемыми печатями и штампами.
Приобрести диплом о высшем образовании.
wo.linyway.com/read-blog/3414
Успешной учебы!
Привет!
Где купить диплом специалиста?
Наша компания предлагает выгодно и быстро приобрести диплом, который выполнен на оригинальной бумаге и заверен печатями, штампами, подписями. Данный документ пройдет любые проверки, даже с использованием специальных приборов. Достигайте свои цели быстро и просто с нашим сервисом.
Заказать диплом любого ВУЗа.
say.la/read-blog/36902
Привет, друзья!
Где купить диплом по нужной специальности?
Наши специалисты предлагают выгодно и быстро купить диплом, который выполнен на бланке ГОЗНАКа и заверен печатями, водяными знаками, подписями должностных лиц. Диплом пройдет лубую проверку, даже с использованием специфических приборов. Решайте свои задачи быстро и просто с нашим сервисом.
Купить диплом ВУЗа.
stass2tm.beget.tech/blogs/1/pokupaem-diplom-v-izvestnom-magazine-po-komfortnoy-tsene.php
Привет, друзья!
Где заказать диплом специалиста?
Наши специалисты предлагают быстро и выгодно купить диплом, который выполнен на оригинальной бумаге и заверен печатями, водяными знаками, подписями. Данный документ пройдет лубую проверку, даже при использовании профессионального оборудования. Решите свои задачи быстро с нашими дипломами.
Купить диплом о высшем образовании.
bintarotrojan.com/blogs/9555/%D0%A1-%D0%BB%D0%B5%D0%B3%D0%BA%D0%BE%D1%81%D1%82%D1%8C%D1%8E-%D0%BF%D0%BE%D0%BA%D1%83%D0%BF%D0%B0%D0%B5%D0%BC-%D0%B4%D0%B8%D0%BF%D0%BB%D0%BE%D0%BC-%D0%B2-%D0%BB%D1%83%D1%87%D1%88%D0%B5%D0%BC-%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD-%D0%BC%D0%B0%D0%B3%D0%B0%D0%B7%D0%B8%D0%BD%D0%B5-Russian-Diplom
Some genuinely wonderful work on behalf of the owner of this site, dead great written content.
wow boost raid http://kreativwerkstatt-esens.de .
кресла и стулья интернет магазин https://office-mebel-in-msk.ru/
Sizin icin harika bir kumarhane Sweet bonanza
купить диплом мфти купить диплом мфти .
диплом купить озон asxdiplomik.com/kupit-diplom-moskva .
Selena Gomez https://calm-down.selenagomez-br.net the story from child star to global musical influence, summarized in hit “Calm Down”, with Rema.
Fabrizio Moretti https://the-strokes.fabriziomoretti-br.com the influential drummer of The Strokes, and his unique sound revolutionized the music scene, remaining icons of modern rock.
A historia da jornada triunfante de Anitta https://veneno.anitta-br.com de aspirante a cantora a uma das interpretes mais influentes da musica moderna, incluindo sua participacao na serie de TV “Veneno”.
In-depth articles about the most famous football players https://zenit-saint-petersburg.wendel-br.com, clubs and events. Learn everything about tactics, rules of the game and football history.
The rise of 20-year-old midfielder Jamal Musiala https://bavaria.jamalmusiala-br.com to the status of a winger in the Bayern Munich team. A story of incredible talent.
EpicAds.Net
Купить диплом магистра оказалось возможно, быстрое обучение и диплом на руки
facefam.com/read-blog/332
Midfielder Rafael Veiga leads https://manchester-city.philfoden-br.com Palmeiras to success – the championship Brazilian and victory in the Copa Libertadores at the age of 24.
Полезные советы по безопасной покупке диплома о высшем образовании
100foto.com/forum/user/1572/
O meio-campista Rafael Veiga leva https://palmeiras.raphaelveiga-br.com o Palmeiras ao sucesso – o campeonato brasileiro e a vitoria na Copa Libertadores aos 24 anos.
The incredible story https://napoli.khvichakvaratskhelia-br.com of a young Georgian talent’s transformation into an Italian Serie A star. Khvicha Kvaraeshvili is a rising phenomenon in European football.
Легальные способы покупки диплома о среднем полном образовании
unguka.com/read-blog/8858
The compelling story of Alisson Becker’s https://bayer-04.florianwirtz-br.com meteoric rise from young talent to key figure in Liverpool’s triumphant era under Jurgen Klopp.
The incredible success story of 20-year-old Florian Wirtz https://bayer-04.florianwirtz-br.com, who quickly joined the Bayer team and became one of the best young talents in the world.
wow mythic raid carry for sale kreativwerkstatt-esens.de .
Ousmane Dembele’s https://paris-saint-germain.ousmanedembele-br.com rise from promising talent to key player for French football giants Paris Saint-Germain. An exciting success story.
Лучшие пансионаты для пожилых людей https://ernst-neizvestniy.ru в Самаре – недорогие дома для престарелых в Самарской области
The fascinating story of Sergio Ramos’ https://seville.sergioramos.net rise from Sevilla graduate to one of Real Madrid and Spain’s greatest defenders.
Пансионаты для пожилых людей https://moyomesto.ru в Самаре по доступным ценам. Специальные условия по уходу, индивидуальные программы.