透過網頁讀取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": [] } } }
Как приобрести диплом техникума с минимальными рисками
купить диплом в уссурийске prema-diploms.ru .
сколько стоит аттестат 9 класс [url=https://4russkiy365-diplomy.ru/]сколько стоит аттестат 9 класс[/url] .
купить диплом лэти [url=https://4russkiy365-diplomy.ru/]4russkiy365-diplomy.ru[/url] .
Welcome to CBridge: Your Gateway to Cross-Chain Transactions
In the rapidly-evolving world of cryptocurrencies, CBridge stands out as a powerful solution for seamless cross-chain transfers. If you are new to the concept, or simply looking to enhance your crypto experience, CBridge offers a robust platform that ensures fast, cost-effective, and secure transactions across multiple blockchain networks.
celer network
What is CBridge?
CBridge is a revolutionary bridge infrastructure designed to facilitate transfers of cryptocurrencies across different blockchain networks. By leveraging the latest in blockchain technology, CBridge allows users to seamlessly move their digital assets between diverse ecosystems without the complexities often associated with such processes.
Key Features of CBridge
High-Speed Transactions: CBridge ensures that cross-chain transfers are completed as quickly as possible, reducing waiting times significantly.
Cost-Effective Solutions: Enjoy lower transaction fees compared to traditional bridges, making it an economical choice for all users.
Security and Privacy: With enhanced security protocols, CBridge maintains the integrity of transactions and protects user data.
User-Friendly Interface: An intuitive platform that simplifies navigation, making it accessible even to beginners.
How Does CBridge Work?
The process is straightforward: users initiate a transaction from their preferred blockchain, select the destination network and currency, and confirm the transfer. CBridge handles the rest, ensuring the digital assets are converted and securely transmitted to the target blockchain.
Benefits of Using CBridge
CBridge not only simplifies the process of moving assets but also opens opportunities for users to explore diverse blockchain applications. Whether you are a trader, investor, or a blockchain enthusiast, CBridge offers a strategic advantage by fostering a truly interconnected crypto ecosystem.
Conclusion
In a world where flexibility and connectivity are key, CBridge offers the optimal solution to unlock new potentials in cross-chain transactions. Its commitment to speed, cost-efficiency, and security makes it an invaluable tool for anyone engaged in the cryptocurrency space.
Приобретение диплома ПТУ с сокращенной программой обучения в Москве
Аттестат 11 класса купить официально с упрощенным обучением в Москве
http://fastpillseasy.com/# best online ed medication
Viagra without a doctor prescription Canada Fast Pills For Men Viagra generic over the counter
стоит ли покупать диплом стоит ли покупать диплом .
купить диплом в энгельсе 2orik-diploms.ru .
Buy Cialis online: Buy Tadalafil 5mg – cialis for sale
The 1win promo code: MAX500WIN. This 1Win bonus code 2025 rewards new players with a 500% bonus up to $1025. Valid codes for receiving bonuses without a deposit for new and old users. Hurry to get them today! Activate the promo code 1win and get a generous welcome bonus of up to 500% on your first four deposits.
1win aviator bonus code
kra9.at – рабочая ссылка на кракен, kraken даркнет
https://fastpillseasy.com/# cheap ed pills online
образование купить диплом люди [url=https://prema-diploms.ru/]prema-diploms.ru[/url] .
купить диплом охраны [url=https://prema-diploms.ru/]prema-diploms.ru[/url] .
look at this web-site https://myjaxxwallet.us
The 1win promo code: MAX500WIN. This 1Win bonus code 2025 rewards new players with a 500% bonus up to $1025. Valid codes for receiving bonuses without a deposit for new and old users. Hurry to get them today! Activate the promo code 1win and get a generous welcome bonus of up to 500% on your first four deposits.
https://latinosdelmundo.com/article/unlock-instant-rewards-with-the-1win-matched-betting-code-for-2025 – 1win registration promo code
Going Here https://web-lumiwallet.com
куплю диплом дорогой 4russkiy365-diplomy.ru .
discount ed meds cheap cialis ed med online
Buy Tadalafil 5mg: MaxPillsForMen – Tadalafil price
Hello colleagues, pleasant piece of writing and nice arguments commented here, I am really enjoying by these.
https://abshop.com.ua/how-to-determine-headlight-sealant-quality.html
куплю диплом рф куплю диплом рф .
low cost ed medication: where to get ed pills – ed meds cheap
What a information of un-ambiguity and preserveness of valuable familiarity about unexpected emotions.
http://keslaser.com.ua/emergency-headlight-repair-on-road.html
http://fastpillseasy.com/# ed medication online
срочно сделать загранпаспорт срочно сделать загранпаспорт .
Можно ли быстро купить диплом старого образца и в чем подвох?