I thought you maybe could help me out here :-)
So I just launched my website, where I will upload some GIFs and have them displayed on the front page.
As of right now, I use a script to show a .png file, when a mouse is hovered, the .gif shows and you can click on it, which will link you to the .gif file.
So right now I got two files for every GIF; xxx.gif and xxx_thumb.png -- however, I would like this to get automatized and thought of a simple script.
In pseudo code:
get .gif
rename to 1.gif
if 1.gif taken? rename to 2.gif
get first frame
export first frame as 1_thumb.png
if 1_thumb.png taken? rename to 2_thumb.png
load new picture? (y/n)
if n
exit
if y
start from step 1
Something like this would be awesome -- how hard would it be to code? Would Ruby or Python do the job?
Would this be possible with a web app, then send the .gif + .png as an email to me? <-- not necessary yet :-)
Thanks for reading this!
For Ruby you could check out rmagick and while this is for an older version of Rails it starts the process you would follow.
Related
I´m just learning to code and hoping for some directions to learn more. I have a project where I´m using a Raspberry Pi and a Canon DSL camera to take a photo every 15 minute and then upload the files to dropbox. The files are named like this: Y/M/D-H/M/S.jpg. Folder structure on dropbox: Year/Month/Day.
I now would like to display these photos in a nice way on a web page. I want to show the latest taken photo as the start image. I then want to make a link menu where it is possible to go back in time and see earlier photos. Back/forward button to jump between the 15 minute interval images. Same with year and date, a step up/down in increments navigate a specific year and month.
Im attaching example to a website that displays what I want to achieve. I dont necessarily need it to be as fancy (like the preview image when scrubbing back in time).
What would be a simple way to achieve this. Preferably a technology/language that is well documented as I want to learn and modify. I would not be surprised if someone has already built something similar. Do I need to learn using a database like php/orMysql for this?
Example:
https://longyearbyen.kystnor.no/
enter image description here
I use Gphoto2 in a simple python script to setup the intervals and naming.
I use a curl command to upload to dropbox via custom app.
I have a word document from a colleague who gave me a .docx Microsoft Word file with 90 images on it that need to be extracted so they can be turned into flashcards. I tried using the Python module "docx2txt" which worked ok, but only extracted 34 images. Upon further inspection, I found that it was because when my coworker made the original file, he took screenshots of PowerPoint slides that he had made with about 4-6 of the images on one slide. Then, he would put them in Word and use the built in Word trimming tool to copy the picture several times and trim down to each individual picture he needed in a particular line of the document. Docx2txt copied the pictures files to my designated directly perfectly, but did not keep the formatting. Any picture file he had inserted and "trimmed down" to size, was copied as the full image. Does anyone know of a way to keep the formatting so I don't have to go through and manually copy 90 pictures one by one? Perhaps converting to a .pdf file and using a pdf related module or something? Or might be there some way of using another Python library which will keep the picture formatting? Thanks for any help you can provide! I'm somewhat of a beginner with Python, but love it when I can get it to automate stuff... even if it ends up taking longer to figure out how to do it than just boring myself to death saving the photos manually, lol.
https://support.microsoft.com/en-us/topic/reduce-the-file-size-of-a-picture-in-microsoft-office-8db7211c-d958-457c-babd-194109eb9535
Important: Cropped parts of the picture are not removed from the file, and can potentially be seen by others; including search engines if the cropped image is posted online. Only the Office desktop apps have the ability to remove cropped areas from the underlying image file.
Follow the relevant section for Desktop Office (Windows or Mac) note from above it CANNOT work on Web 365.
go to "Other kinds of cropping"
Important: If you delete cropped areas and later change your mind, you can click the Undo Button Image button to restore them. Deletions can [ONLY] be undone until the file is saved.
So make a backup copy of the file
Select the picture or pictures (If you want all selected that should be easy with CTRL + A to highlight everything)
Then follow the instructions
Picture Tools > Format, and in the Adjust group, click Compress Pictures
Be sure that the Delete cropped areas of pictures check box is selected
DEselect the Apply only to this picture check box.
Double check a few manually to verify all is well then save a copy.
I´ve created an app using Streamlit, which needs to read multiple files at once. I´m using the file_uploader() component with the parameter accept_multiple_files=True.
I got 2 questions:
First is if there´s a way to hide the bottom HTML/Widget that appears after uploading a file/s (see picture below)?
And second, if there´s a way to remove the drag&drop option, just leaving "Browse Files" toggle button?
The best solution currently is using the st.beta_expander() to hide the st.file_uploader() without having to programmatically play with the rerunning script to see if files were added. So for example in my problem it would be something like:
with st.beta_expander("Upload DICOM Files"):
uploaded_files = st.file_uploader("Select DICOM Files:",
accept_multiple_files=True,
type='dcm')
More info about the st.beta_expander() and what can be done with it here.
Im working on a project that needs to process images from one file and output to another the change is varied but the main one is colour profiles that need to be changed however everything i see so far is only able to convert to sRGB or that range but i would need to ether be able to add a profile or have an extensive or full list of profiles to convert to. for example one of the profiles ill be needing to use is eciRGB v2.
Please help me to automate this in python (I cant use photoshop...) .
You can do this with ImageMagick and terminal.
Download the colour profile(eciRGB_v2.icc) and make sure you know the path to it, I recommend keeping it in the same directory as your images.
example set up
Then open Terminal at that directory and run this code:
convert image.tif -profile eciRGB_V2.icc output.tif
example of result
Link to download ImageMagick: https://imagemagick.org/index.php
I have a parent file type that is folderish, and I would like to include a thumbnail of the first page of a child pdf in the template. Can someone roughly outline the tools and process you can imagine would achieve this, so that I can investigate further?
Getting out the first page of pdf can be achieved by using ghostscript.
This is an example script which forms an gostscript command and stores the images. I took this from collective.pdfpeek. Which by the way could solve your problem right away :-)
Until few days ago I would have recommended you not to use it, since it was a little bit buggy, but they recently shipped a new version, so give it a try! I'm not sure whether they now support DX or not.
So the workflow for you should be.
Uploading a PDF
Subscribe modified/creation events.
create image of first page using ghostscript (check my command, or collective.pdfpeek)
store it as blob (NamedBlobImage) on your uploaded pdf.
Also implement some queueing like collective.pdfpeek to not block all your threads with ghostscript commands.
OR
Give collective.pdfpeek a shot!
BTW:
imho on a large scale the preview generation for pdfs needs to be implemented as a service, which stores/manages the images for you.