透過網頁讀取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": [] } } }
Профессиональный сервисный центр по ремонту объективов в Москве.
Мы предлагаем: цены на ремонт объективов
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Thai farmer forced to kill more than 100 endangered crocodiles after a typhoon damaged their enclosure
kraken зайти
A Thai crocodile farmer who goes by the nickname “Crocodile X” said he killed more than 100 critically endangered reptiles to prevent them from escaping after a typhoon damaged their enclosure.
Natthapak Khumkad, 37, who runs a crocodile farm in Lamphun, northern Thailand, said he scrambled to find his Siamese crocodiles a new home when he noticed a wall securing their enclosure was at risk of collapsing. But nowhere was large or secure enough to hold the crocodiles, some of which were up to 4 meters (13 feet) long.
To stop the crocodiles from getting loose into the local community, Natthapak said, he put 125 of them down on September 22.
“I had to make the most difficult decision of my life to kill them all,” he told CNN. “My family and I discussed if the wall collapsed the damage to people’s lives would be far bigger than we can control. It would involve people’s lives and public safety.”
Typhoon Yagi, Asia’s most powerful storm this year, swept across southern China and Southeast Asia this month, leaving a trail of destruction with its intense rainfall and powerful winds. Downpours inundated Thailand’s north, submerging homes and riverside villages, killing at least nine people.
Storms like Yagi are “getting stronger due to climate change, primarily because warmer ocean waters provide more energy to fuel the storms, leading to increased wind speeds and heavier rainfall,” said Benjamin Horton, director of the Earth Observatory of Singapore.
Natural disasters, including typhoons, pose a range of threats to wildlife, according to the International Fund for Animal Welfare. Flooding can leave animals stranded, in danger of drowning, or separated from their owners or families.
Rain and strong winds can also severely damage habitats and animal shelters. In 2022, Hurricane Ian hit Florida and destroyed the Little Bear Sanctuary in Punta Gorda, leaving 200 animals, including cows, horses, donkeys, pigs and birds without shelter.
The risk of natural disasters to animals is only increasing as human-caused climate change makes extreme weather events more frequent and volatile.
Веселые еврейские анекдоты
Подними настроение
Профессиональный сервисный центр по ремонту серверов в Москве.
Мы предлагаем: срочный ремонт компьютеров на дому
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
http://pharmaciepascher.pro/# pharmacie en ligne france livraison internationale
Thai farmer forced to kill more than 100 endangered crocodiles after a typhoon damaged their enclosure
kraken войти
A Thai crocodile farmer who goes by the nickname “Crocodile X” said he killed more than 100 critically endangered reptiles to prevent them from escaping after a typhoon damaged their enclosure.
Natthapak Khumkad, 37, who runs a crocodile farm in Lamphun, northern Thailand, said he scrambled to find his Siamese crocodiles a new home when he noticed a wall securing their enclosure was at risk of collapsing. But nowhere was large or secure enough to hold the crocodiles, some of which were up to 4 meters (13 feet) long.
To stop the crocodiles from getting loose into the local community, Natthapak said, he put 125 of them down on September 22.
“I had to make the most difficult decision of my life to kill them all,” he told CNN. “My family and I discussed if the wall collapsed the damage to people’s lives would be far bigger than we can control. It would involve people’s lives and public safety.”
Typhoon Yagi, Asia’s most powerful storm this year, swept across southern China and Southeast Asia this month, leaving a trail of destruction with its intense rainfall and powerful winds. Downpours inundated Thailand’s north, submerging homes and riverside villages, killing at least nine people.
Storms like Yagi are “getting stronger due to climate change, primarily because warmer ocean waters provide more energy to fuel the storms, leading to increased wind speeds and heavier rainfall,” said Benjamin Horton, director of the Earth Observatory of Singapore.
Natural disasters, including typhoons, pose a range of threats to wildlife, according to the International Fund for Animal Welfare. Flooding can leave animals stranded, in danger of drowning, or separated from their owners or families.
Rain and strong winds can also severely damage habitats and animal shelters. In 2022, Hurricane Ian hit Florida and destroyed the Little Bear Sanctuary in Punta Gorda, leaving 200 animals, including cows, horses, donkeys, pigs and birds without shelter.
The risk of natural disasters to animals is only increasing as human-caused climate change makes extreme weather events more frequent and volatile.
Thai farmer forced to kill more than 100 endangered crocodiles after a typhoon damaged their enclosure
kraken marketplace
A Thai crocodile farmer who goes by the nickname “Crocodile X” said he killed more than 100 critically endangered reptiles to prevent them from escaping after a typhoon damaged their enclosure.
Natthapak Khumkad, 37, who runs a crocodile farm in Lamphun, northern Thailand, said he scrambled to find his Siamese crocodiles a new home when he noticed a wall securing their enclosure was at risk of collapsing. But nowhere was large or secure enough to hold the crocodiles, some of which were up to 4 meters (13 feet) long.
To stop the crocodiles from getting loose into the local community, Natthapak said, he put 125 of them down on September 22.
“I had to make the most difficult decision of my life to kill them all,” he told CNN. “My family and I discussed if the wall collapsed the damage to people’s lives would be far bigger than we can control. It would involve people’s lives and public safety.”
Typhoon Yagi, Asia’s most powerful storm this year, swept across southern China and Southeast Asia this month, leaving a trail of destruction with its intense rainfall and powerful winds. Downpours inundated Thailand’s north, submerging homes and riverside villages, killing at least nine people.
Storms like Yagi are “getting stronger due to climate change, primarily because warmer ocean waters provide more energy to fuel the storms, leading to increased wind speeds and heavier rainfall,” said Benjamin Horton, director of the Earth Observatory of Singapore.
Natural disasters, including typhoons, pose a range of threats to wildlife, according to the International Fund for Animal Welfare. Flooding can leave animals stranded, in danger of drowning, or separated from their owners or families.
Rain and strong winds can also severely damage habitats and animal shelters. In 2022, Hurricane Ian hit Florida and destroyed the Little Bear Sanctuary in Punta Gorda, leaving 200 animals, including cows, horses, donkeys, pigs and birds without shelter.
The risk of natural disasters to animals is only increasing as human-caused climate change makes extreme weather events more frequent and volatile.
Смешные приколы
Отдохни и посмейся
Thai farmer forced to kill more than 100 endangered crocodiles after a typhoon damaged their enclosure
kraken магазин
A Thai crocodile farmer who goes by the nickname “Crocodile X” said he killed more than 100 critically endangered reptiles to prevent them from escaping after a typhoon damaged their enclosure.
Natthapak Khumkad, 37, who runs a crocodile farm in Lamphun, northern Thailand, said he scrambled to find his Siamese crocodiles a new home when he noticed a wall securing their enclosure was at risk of collapsing. But nowhere was large or secure enough to hold the crocodiles, some of which were up to 4 meters (13 feet) long.
To stop the crocodiles from getting loose into the local community, Natthapak said, he put 125 of them down on September 22.
“I had to make the most difficult decision of my life to kill them all,” he told CNN. “My family and I discussed if the wall collapsed the damage to people’s lives would be far bigger than we can control. It would involve people’s lives and public safety.”
Typhoon Yagi, Asia’s most powerful storm this year, swept across southern China and Southeast Asia this month, leaving a trail of destruction with its intense rainfall and powerful winds. Downpours inundated Thailand’s north, submerging homes and riverside villages, killing at least nine people.
Storms like Yagi are “getting stronger due to climate change, primarily because warmer ocean waters provide more energy to fuel the storms, leading to increased wind speeds and heavier rainfall,” said Benjamin Horton, director of the Earth Observatory of Singapore.
Natural disasters, including typhoons, pose a range of threats to wildlife, according to the International Fund for Animal Welfare. Flooding can leave animals stranded, in danger of drowning, or separated from their owners or families.
Rain and strong winds can also severely damage habitats and animal shelters. In 2022, Hurricane Ian hit Florida and destroyed the Little Bear Sanctuary in Punta Gorda, leaving 200 animals, including cows, horses, donkeys, pigs and birds without shelter.
The risk of natural disasters to animals is only increasing as human-caused climate change makes extreme weather events more frequent and volatile.
Is Sweet Bonanza High Volatility? – What to Expect Sweet Bonanza is known for its high volatility, offering less frequent but bigger wins. Learn how this affects your gameplay and why it’s appealing for risk-takers.
slot bonanza
Веселые приколы
Подними настроение
SildГ©nafil 100mg pharmacie en ligne: Acheter du Viagra sans ordonnance – Viagra sans ordonnance pharmacie France
Продажа мини-погрузчиков Lonking
Продажа мини-погрузчиков Lonking на территории России от официального
дистрибьютора. Новая многофункциональная техника для любых задач.
Наши машины предназначены для того, чтобы упростить вашу работу:
от строительных площадок до складских операций.
Высокая эффективность, надежность и инновационные решения — все,
что вам нужно для успешных проектов. Погрузите свой бизнес в будущее
с мини-погрузчиками Lonking!
47% российских покупателей выбрали мини-погрузчики Lonking в 2023 году
продано более 1200 единиц.
Lonking
Thai farmer forced to kill more than 100 endangered crocodiles after a typhoon damaged their enclosure
kraken войти
A Thai crocodile farmer who goes by the nickname “Crocodile X” said he killed more than 100 critically endangered reptiles to prevent them from escaping after a typhoon damaged their enclosure.
Natthapak Khumkad, 37, who runs a crocodile farm in Lamphun, northern Thailand, said he scrambled to find his Siamese crocodiles a new home when he noticed a wall securing their enclosure was at risk of collapsing. But nowhere was large or secure enough to hold the crocodiles, some of which were up to 4 meters (13 feet) long.
To stop the crocodiles from getting loose into the local community, Natthapak said, he put 125 of them down on September 22.
“I had to make the most difficult decision of my life to kill them all,” he told CNN. “My family and I discussed if the wall collapsed the damage to people’s lives would be far bigger than we can control. It would involve people’s lives and public safety.”
Typhoon Yagi, Asia’s most powerful storm this year, swept across southern China and Southeast Asia this month, leaving a trail of destruction with its intense rainfall and powerful winds. Downpours inundated Thailand’s north, submerging homes and riverside villages, killing at least nine people.
Storms like Yagi are “getting stronger due to climate change, primarily because warmer ocean waters provide more energy to fuel the storms, leading to increased wind speeds and heavier rainfall,” said Benjamin Horton, director of the Earth Observatory of Singapore.
Natural disasters, including typhoons, pose a range of threats to wildlife, according to the International Fund for Animal Welfare. Flooding can leave animals stranded, in danger of drowning, or separated from their owners or families.
Rain and strong winds can also severely damage habitats and animal shelters. In 2022, Hurricane Ian hit Florida and destroyed the Little Bear Sanctuary in Punta Gorda, leaving 200 animals, including cows, horses, donkeys, pigs and birds without shelter.
The risk of natural disasters to animals is only increasing as human-caused climate change makes extreme weather events more frequent and volatile.
реабилитационные центры для алкоголиков крым http://xn—–7kcablenaafvie2ajgchok2abjaz3cd3a1k2h.xn--p1ai/ .
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервисные центры по ремонту техники в уфе
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Сервисный центр предлагает ремонт кофемашины promac на дому качественый ремонт кофемашин promac
Профессиональный сервисный центр по ремонту серверов в Москве.
Мы предлагаем: ремонт и обслуживание серверов
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
my page Free poker
турникет купить дешево турникет купить дешево .
Профессиональный сервисный центр по ремонту серверов в Москве.
Мы предлагаем: ремонт серверного оборудования
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Профессиональный сервисный центр по ремонту принтеров в Москве.
Мы предлагаем: ремонт принтеров с гарантией
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
my web blog: Explore Daycares Locations (Don)
самая эффективная кодировка от алкоголя самая эффективная кодировка от алкоголя .
Профессиональный сервисный центр по ремонту серверов в Москве.
Мы предлагаем: срочный ремонт сервера
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Как развить чувство юмора с помощью смешных шуток
Viagra homme prix en pharmacie sans ordonnance Viagra generique en pharmacie Viagra homme prix en pharmacie
Профессиональный сервисный центр по ремонту принтеров в Москве.
Мы предлагаем: починка принтера
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Профессиональный сервисный центр по ремонту серверов в Москве.
Мы предлагаем: ремонт серверов цены
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
1x Bet Bonus Code https://idematapp.com/wp-content/pages/1xbet_promo_codes_free_bonus_offers.html
A 1x Bet bonus code is a code that unlocks bonuses such as deposit matches, free bets, or free spins. These codes are often provided as part of welcome offers or special promotions and can be entered during registration or when making a deposit.