- An option for the user to input the list of images to convert (or fetching it via the API according to certain parameters, like getting all images of a certain format).
- Afterwards, the script gets the list of all pages each image is included in.
- This is the trickiest part: the script downloads each image and passes it through a third-party utility that converts it and returns a copy of the desired format. You'd have to look for a JavaScript utility for image conversion. You'd probably have to experiment with a few to see which is better for your purposes, which has the best quality/size/conversion time ratio, and setting some timeouts to avoid being blocked by Wikia if you happen to download too many files too fast. If you're working with a large number of images, an utility that runs on the cloud rather than on the user's browser may be preferable for bandwidth and memory reasons.
- The script uploads the converted image to the wiki and copies its file information.
- It replaces the file in all pages that were using the old one.
- Finally, it deletes the old image.
ALL POSTSHaving a JS bot convert .jpg to .png images once already uploaded on a wiki
<p>Whether already created, or if it can be made may I know how I could use a bot (currently has these) using JS to convert the .jpg Images in image galleries to .png format? They are already in one area so can be done gallery by gallery. There is a working method using a regular bot program, which would require:
</p>
(Edited by S3r0-Ph1i)
<p>Other contributors are uploading the files and presumably manually converting, hence why I felt if a bot could save the time best use that. Converting wordmark images to .png also removes a background, but in any case since .png files don't become pixelated when changed in size probably best if they were all converted to .png format.
</p>
(Edited by S3r0-Ph1i)
<p>If the only action to be done on an image was converting it to PNG, you would have the option of:
</p>
- Using a batch downloader to download the images you need converted (one probably exists somewhere)
- Using an image batch converter to convert the images from one format to another (there seem to be many available online)
- Using a batch uploader to upload the converted images (for example, Wiki-Up)
- Using a batch delete tool to delete the old images (for example, AjaxBatchDelete)
(Edited by KockaAdmiralac)
<p>Are there JS scripts that can achieve the same outcome? Especially for mass uploading images, need a much faster way of doing that.
</p>
<div class="quote"><i>KockaAdmiralac wrote:
<p>However, if you intend to remove the backgrounds of these images alongside converting them, that might be a trickier job. How would the converter know what exactly <i>is</i> the background? If it just turns a specified color transparent, how are you sure the same color doesn't appear in the actual image?
</p>
</i></div>
<p>If they are converted on the wiki and the backgrounds aren't removed, can simply re-upload over them so that is covered. </p>
<p>If they are converted on the wiki and the backgrounds aren't removed, can simply re-upload over them so that is covered. </p>
(Edited by S3r0-Ph1i)
<div class="quote"><i>S3r0-Ph1i wrote: Are there JS scripts that can achieve the same outcome? Especially for mass uploading images, need a much faster way of doing that.</i></div>
<p>There aren't any scripts for batch image conversion on Dev, and I don't really think there would need to be considering there are many other online and offline tools for it. As for uploading images, I don't think an offline tool could be any slower than a Dev script in that. </p>
<p>There aren't any scripts for batch image conversion on Dev, and I don't really think there would need to be considering there are many other online and offline tools for it. As for uploading images, I don't think an offline tool could be any slower than a Dev script in that. </p>
(Edited by KockaAdmiralac)
<div class="quote"><i>KockaAdmiralac wrote:
<p>There aren't any scripts for batch image conversion on Dev, and I don't really think there would need to be considering there are many other online and offline tools for it.
</p>
</i></div>
<p>Would these work for users who don't have computers, like those using tablets or MacBooks? The other need for a JS method is to keep everything here on Fandom - other sites are prone to suddenly closing down, for fun, apparently. Same with the mass upload of images, if there is a JS way to do that, and a way that works for Fandom rather than being reliant on other sites that would be best. </p>
<p>Would these work for users who don't have computers, like those using tablets or MacBooks? The other need for a JS method is to keep everything here on Fandom - other sites are prone to suddenly closing down, for fun, apparently. Same with the mass upload of images, if there is a JS way to do that, and a way that works for Fandom rather than being reliant on other sites that would be best. </p>
(Edited by S3r0-Ph1i)
<div class="quote"><i>S3r0-Ph1i wrote: Would these work for users who don't have computers, like those using tablets or MacBooks? The other need for a JS method is to keep everything here on Fandom - other sites are prone to suddenly closing down, for fun, apparently.</i></div>
<p>The thing is that an action of batch-converting images is not really something mobile devices are expected to do. If you're using an offline tool you would be very little relying on a site. </p> <div class="quote"><i>S3r0-Ph1i wrote: Same with the mass upload of images, if there is a JS way to do that, and a way that works for Fandom rather than being reliant on other sites that would be best.</i></div>
<p>There's MultiUpload. </p>
<p>The thing is that an action of batch-converting images is not really something mobile devices are expected to do. If you're using an offline tool you would be very little relying on a site. </p> <div class="quote"><i>S3r0-Ph1i wrote: Same with the mass upload of images, if there is a JS way to do that, and a way that works for Fandom rather than being reliant on other sites that would be best.</i></div>
<p>There's MultiUpload. </p>
(Edited by KockaAdmiralac)
<p>Would the offline tools work on macs, if not could JS work?
</p><p>Thank you for pointing out the MultiUpload, that's all added and will be so handy!
</p>
(Edited by S3r0-Ph1i)
<p>Some of the most popular tools I've noticed when Googling for "image batch conversion" seem to be cross-platform, so yeah, some should work.
</p>
(Edited by KockaAdmiralac)
<p>I'm not sure if batch image conversion is possible with any changes in the background (or any changes at all. I usually use any photo editor for each image. As for conversion itself, I've been using this site https://img-converter.com/en/convert/jpg-to-png/ to convert a ton of files and I've never had any troubles with it. It works very fast and gives you no viruses or problems.
</p>
(Edited by Danball93)
<p>Thank you, at the time such a feature that converted images already on a wiki was in mind. For example (if these were .jpg images) having a tool on Fandom to change those images into .png formats would save time having to download them, run them through the converter then re-upload them.
</p>
(Edited by S3r0-Ph1i)