Download assets in it's original format in AEM - download

I want to download the asset in it's original format using AEM, is it possible? Currently, if I select one pdf or jpeg asset, and click download, it's downloaded as a zip file which includes the selected asset. Now I want to download it without a container zip, that's to say download it in it's original format.

If you are referring to PDF then that's how the download for PDF works because when a PDF is uploaded all it's contents are extracted as sub-assets. This behaviour can be changed via modifying the PDF extraction logic but it won't affect the download behaviour.
The logic behind this is that when an artefact is uploaded in AEM it becomes a DAM asset and rules governing to it's manipulation take over. For example, in case of PDF, a PDF asset is a collection of the original PDF and all it's images and thumbnail extractions. So when you are downloading something you are basically downloading the whole collection as AEM sees it.
Having said that, you can probably write a custom servlet and extend the DAM GUI to download just the PDF.

You can select the option as shown below, when selecting 'Download' action after selecting the asset to download, in Assets UI

Related

Is there a fast way of gathering image files from external sources (Chrome Developer Tab)

Let's say I visit a website named abc.xyz.
When I get to the website, I see the website runs a javascript script to create an interactive book. Obviously, the book must have image files for each page.
Now let's say I go to the developer tools tab and go to the sources tab to find the images - sure enough, I find them. However, the images come from a folder and domain named xyz.abc that displays a 403 error when accessed.
Is there a faster way of gathering these image files than visiting the links for every single image and individually saving every single image (Bare in mind the images themselves are not restricted access)?
Real World Example:
Image showing files under the sources tab.
In the image above, you can see there are several image files located in a folder (hundreds, in fact). The domain and folder the images reside in display 403 errors when accessed, however the images themselves are not restricted. To download the images, you can individually get the link to each image and use "Save image as". However, this will be time-consuming for hundreds of images - is there a faster way to download all the images?
Edit: Furthermore, would there be a way to quickly order PDF images via a pre-existing page number on the PDF file.
To get images of a webpage , you can use python script to fetch all the image src which later u can perform any operations on it , such as copy it to your system or into your website .
I've used BeautifulSoup for webscraping
from bs4 import BeautifulSoup
import requests
page = requests.get("https://stackoverflow.com/questions/63939080/is-there-a-fast-way-of-gathering-image-files-from-external-sources-chrome-devel")
soup = BeautifulSoup(page.content, 'html.parser')
#print(soup.prettify())
for element in soup.find_all("img"):
try:
print(element['src'])
except Exception as e:
pass

How can I export gallery images from SquareSpace?

SquareSpace does not offer any way to export uploaded content directly. The only export option available is for WordPress, but this only generates a small XML file. What is the best way to download the actual image files from a gallery, other than right-clicking each image and choosing "Save as..."?
This worked for me [Python]. If you take the XML file that is exported for you, you can run the following against it.
I had only .png images uploaded. You will have to modify to include jpg and other image file formats.
import requests
import shutil
import xml.etree.ElementTree as ET
tree = ET.parse('filename.xml')
root = tree.getroot()
for i in root.findall('wp:attachment_url'):
print(i)
images = set([elem.text for elem in root.iter() if elem.tag=='link' and '.png' in elem.text])
for img in images:
resp = requests.get(img+'?format=3000w', stream=True)
local_file = open(f'images/{img.split("/")[-1]}', 'wb')
resp.raw.decode_content = True
shutil.copyfileobj(resp.raw, local_file)
del resp
In Chrome: File > Save Page As > Web Page Complete
Do this for each page that you want to download the images from.
I just spent way too long figuring out how to do this, so I'm leaving this here in hopes that it will save someone else time. It's not pretty, and it involves a browser extension, but I believe this is the most efficient way. Broadly speaking, this is what the process looks like:
Set up new local WordPress installation. http://www.wpbeginner.com/wp-tutorials/how-to-create-a-local-wordpress-site-using-xampp/
Export your SquareSpace site for WordPress and import it into the new installation. Ignore errors about attachments. All image galleries will now show up as pages in WordPress, with each image hotlinked to the medium-sized version of the image in the original SquareSpace site. https://support.squarespace.com/hc/en-us/articles/206566687-Exporting-your-site
Install a browser extension that lets you bulk-download images on a webpage. I used this Chrome extension: https://chrome.google.com/webstore/detail/bulk-image-downloader/lamfengpphafgjdgacmmnpakdphmjlji
Repeat the following steps for each gallery:
On the page editor, switch to text view. Copy the HTML into your favorite text editor, and use the find/replace feature to replace ".JPG" with ".JPG?format=2500w" on every image URL to force the full-size resolution. Paste the updated HTML back into WordPress and update the page.
View the updated page, and use the browser extension you installed earlier to download all the images on the page. If you have a large gallery, you might have to scroll down to the bottom of the page to force all the images to load before downloading them.
That's it. All said and done, it's a pretty simple and straightforward process. I went through a lot of different WordPress plugins in an attempt to rehost the external links to the local wp-content folder, export the media library by post, etc. This ended up being much faster and much simpler. Hope it saves you some time.
If you don't have too many images, you can do them one at a time from a gallery. While viewing a gallery (Chrome) I can right-click and open the image in a new tab and then save that (getting rid of the parameters after *.jpeg )
You can use this repo to download the images from Squarespace. It has a Tkinter GUI to make it easier to use :)
I just coded it and it works fine on my end.
Github link: https://github.com/Mascobot/squarespace_image_downloader
I downloaded the Image Downloader plugin from Chrome. Super easy to download all images into folders. Once installed, go to the URL of your website page, hit the plugin, and create a download folder. Done.
Here's an alternative:
Use a crawler like ScreamingFrog and crawl your entire domain.
Copy all of your image URLs.
Download the Chrome Addon 'Tab Save' and paste all the links in there.
Download them. Done!
Copy the image and open it in a photo editor like Preview and then export it.
That works well for a few images but not so well for many.
Or screen shots. Make the image as large as possible and screen shoot it that way.

How to open image file using pdftron

I want to load an image file using the pdftron webviewer api.
For pdf files it's working fine but I want to load image files and add annotations to them.
In the user guide there is no information regarding working with images.
Yes, WebViewer can do this out of the box.
There are a number of image formats supported. Here is the breakdown.
PNG, JPEG
Simply pass the image URL to WebViewer initialDoc constructor parameter, or to WebViewer.loadDocument().
If your URL does not have a proper file extension, then you can do the following.
myWebViewer.loadDocument("mydomain/generic_url_to_image", {filename: "input.png"})
This works with both PDFNetJS Lean and Full editions.
TIFF, GIF, BMP
You can utilize the browser's HTML5 canvas to load the images, and then generate PNG/JPG from the HTML5 canvas, and then pass the follow the instructions above.
JP2 or multiple images in one document.
Using PDFNetJS Full edition, which does not come with the standard WebViewer download, you have full control over PDF creation.
PDFNetJS Full Download: http://pdftron.com/downloads/PDFNetJS.zip
Using PDFNetJS Full you would follow the AddImage sample code to construct a PDF with the image(s) in it.
http://pdftron.com/webviewer/pdfnetjs/config.html#file=samples/PDFNet/AddImageTest/AddImageTest.js

How to load images (jpg) in QML generated at runtime

my question is quite simple.
I have a Qt application with a Gui developed with QML.
My back-end side generates and saves jpg images in a folder called /images .
I am able to send from C++ to QML the strings holding the name of the images that I want to show. Sadly my QML Image object doesn't display anything.
It seems that if an image can be displayed only if it has been previously declared in the qml.qrc file.
Sadly, again, qrc files do not support wildcards yet!
https://bugreports.qt.io/browse/QTBUG-1400
Is there a workaround?
The name of the images are not fixed, they are generated with certain runtime values i.e. timestamp.
Thank you
By default it will search the image source in the qrc file. To make it go to the actual file system, prepend a file:/// to the path.

Extract images from .swf viewer?

I'm wondering how it possible to extract images from .swf viewer?
Note that .swf file have not images itself.
For example I'm trying extract images from AVON catalogue from this link - http://avon.com.ua/PRSuite/eBrochure.page?index=1&cmpgnYrNr=201404&pageNo=0
Any ideas?
Best way is to put the .swf file in a decompiler for image extraction. Decompilers are smart enough to extract images for you and arrange them.
JPEXS Free Flash Decompiler is a more popular one
http://www.free-decompiler.com/flash/
You can extract other useful content from it as well.
Just download the .swf file from the website
A while back (like around 1999) I wrote a set of tools for Flash animations.
One of the tools is swf_dump which can be used to extract objects (i.e. write the objects in a form of script that sswf can nearly recompile...)
The tool also allows for extracting images that are inline (not downloaded dynamically by the flash animation, if so, anyway, you could as well download those images manually, you'd need the URL, though.)
The command line you can use is:
swf_dump -d my-animation.swf
Then your current folder will be littered with all the images that were found in the flash file. It extracts JPEGs and PNGs. The source can be compressed (SWF or CWF are supported.)
Now, you're on your own to compile that thing... The project is here and is in great need of updating (but Flash is kind of going out too...)
https://sourceforge.net/projects/sswf/

Resources