Modify & Export a PNG [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
A while ago I had created a small system that would allow one to select various images to use in a forum signature that were all designed to fit together (see example image below). This is currently done by having a series of images that get referenced by their names, which folder they're in, and suffixes in the image names.
I would like to create a system where one could modify these all they wanted. I tried looking up a few different ways to do it, however was unsuccessful in finding any way that would be able to do what I'm aiming to do here.
The original images are made in Photoshop and separated into individual layers based on the type of banner. Ideally I'd love to make a system that would allow one to modify the colours (RGB, slider, something like that), change the icon either by a set of preset icons or uploading their own, and the ability to modify the text on the images.
After all is said and done, I'd like the image pieces to be downloadable so they're not stored server-side. In addition I'd like to do this without having to export every variation possible, since that's already a nuisance with the current way it's doing things.
TL;DR:
Is there any way a user could modify a set of parameters to change colours, icons, or text, then download the result as a PNG? Code type does not matter, I'm willing to learn, just want to know the right direction.
Here's a download of the current code for anyone interested.
https://dl.dropboxusercontent.com/u/90098446/website.zip
Example Image (ignore the white lines):

Seems like each banner has four layers: banner, icon, text, and optional tears.
Save the individual layers and assemble them via javascript on the front-end. Arranging the parts as sprite sheets may make this more convenient both for editing in Photoshop and for assembling programmatically.
When the user wants to download the results, send a description of the assembly to the back-end, have the back-end assemble the parts into an image, and offer the image for download.
Rather than manually assembling each possibility in Photoshop, you instead let the system assemble it on demand.

I have actually done something like this. You need to use a canvas in your HTML and to have a finite number of possible images or possibly some Javascript functions to draw the thing the user wants. Those images/functions should be put together in your canvas to enable the user to preview what is his picture and a control set to change things.
This SO post shows you how you can get a png from a canvas. I suggest that you should have a save button, where the user finalizes the picture and this should send the picture to the server, where it will be stored. The download feature should download that picture.
I have done this differently. I have used canvas as a preview and when the user finalized the settings, those were sent to the server as JSON where the final picture was put together.

Related

Create interactive engineering part drawing accessed via web page

I am trying to make a seamless process for creating engineering part drawings that have interactive balloons that will somehow go to the part you clicked. A part balloon contains a part number, I want the user to be able to click that part number to go to that selected part number drawing.
What I am asking help for is if anyone knows or has any recommendations how to achieve this.
We use Solidworks as our CAD software. Currently we create save a copy of the drawing in Solidworks to PDF and that is then converted to an enlarged PNG programmatically. There are currently no hooks, anchors or tags associated with the PNG. The PNG is displayed on our parts browsing website. Currently you cannot interact with the drawing on the webpage other than zooming in and out.
I can change that process to whatever will work, but it needs to be almost completely automated. Any ideas would be appreciated.
So far I have looked into adding JavaScript to the actual PDF document programmatically, but I do not fully understand the interaction between web based JavaScript and PDF JavaScript. There is not much online either, or else I couldn't find it. I have also looked into adding links to the PDF, but i cannot get it to open in the current iFrame when a user clicks a link on the PDF, where i would normally user target="_self" to mitigate this.
Please let me know if I can clarify something, as there is a lot of information and it would be overwhelming to write on here.

Convert text to embroidery stitches in c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am developing a product configurator in asp.net C# probabely like http://www.vistaprint.in/vp/ns/easypath/studio.aspx?template=446855~s1_BJD_BJX&ag=True&xnav=previews&xnid=image_112&rd=1
I am stuck on these 3 questions.
Users will upload a clear image with simple(no gradients) text on it. I would like to change this text on image to embroidery stitched text? Text can be straight line text or curved text or any other shape.
If it is not possible with text on image ,can I simply convert the text into embroidery stitched text? Text can be straight line text or curved text or any other shape.
Can this be done using some jquery or javascript or C# plugins? If yes,please suggest.
As I am new to product configurator ,I have no idea from where to start from
and require some helping hands.
Method 1
One way I would go for this is to have different image for each letter a-z A-Z and also each digit 0-9. (With a transparent background)
When the user is done typing I would send an ajax request to the server with the user's input and the response would be an image with the text itself. (jQuery could be used for this purpose)
On the server side for each letter in the user's input I would fetch the appropriate image For example "a" would be . (It is better for the letters to be with a transparent background).
Using something like this Combine two Images into one new Image I would create the full text and than send it back to the client.
On the client side you would know roughly where to put the new image on the canvas. /For example it has to be centred vertically and horizontally./
And finally if you want to curve, manipulate, etc. the text you can also use standart C# tools - MSDN Also this SO answer - here.
Method 2
Another way is to create /or use/ a custom font (One appropriate can be found here and here) And render the image using it. Please check this SO question. If you need a more serious text manipulation, probably this method is more appropriate.

Why is my website loading so slow? How can I fix it? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My website at http://droid.ly is loading extremely slowly!
What can I do to fix it? Any and all help is greatly appreciated.
Thanks!
Here are couple of things you can try to reduce loading time.
First of all if you are using JS and you are giving online path then try to use that file in your code and give path from you project.instead of using online paths for JS.
Remove Comments and white spaces from javascript. you can use online javascript Compression tool to remove white spaces and comments.
Enable browser caching
Avoid bad requests. check whether you have any broken link.if you do have then make it correct or remove
Try to Use Internal / external CSS .. and dont use inline styles.
Reduce the number of plugins you use on your site
Put CSS at the top and JS at the bottom
Last but not Least .. Image plays roles in site loading time. try to use optimize image..
For more Please follow the link below..
Reducing site loading time
You are using a landing page (one page site) and You have TOO MUCH images on it.
The browser needs to pre-load all the images and that takes some time.
1 - Optimize the images for web view
2 - Try to reduce the amount of your images
3 - Use a plugin that loads the images while scrolling, so the request will be reduced
Try this plugin:
'http://ressio.github.io/lazy-load-xt/demo/index.htm'
Or this one:
http://www.appelsiini.net/projects/lazyload
In this way you will reduce the page load problem.
You have some high resolution PNG images that will load quite slow depending on the connection. Using JPEG format for high resolution photos instead of PNG can reduce their size quite a bit, without significant quality loss. Apart from that consider concatenating and minifying your scripts/stylesheets and gzip everything if possible.
Open chrome, then open developer tools, open Audits tab, chose "Reload page and Audit...", push run button.
Chrome will give you the same advices, as in this answers.
From me:
Make one css file from all css you have.
Make one js file from all js you have.
Resize images on server, make them smaller.
Are you sure, that you are using all symbols from your font files ?Try to remove unused symbols from font files (you can create custom font file from svg files, i manage my fonts via https://icomoon.io/)
And you will see the difference

Floor-plan in Android and svg [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to show a simple custom floor-plan in my Android app, something similar to the image below:
The target is to colour the area where I am currently in (I get this info in my app):
It would be perfect if each of these areas are also clickable to set an onclicklistener or similar and be able to zoom in/out as with images.
The main restriction is I want everything local, that is, no connection to an internet service to import the image.
I have tried loading an html which contains an svg floor-plan, but I don't know how to change the colour of an area from Android when I move from one area to another.
How can I approach this?
You can create a simple html page within a WebView and attach the SVG and add Javascript, so when tapping on the some elements in the svg to call a javascript function. You can then sent the events to the native java code in your android app if your app is native or just handle it in the html.
I believe this article is especially for your question Interfacing with SVG
you'r floor looks a lot like a grid layout!! why are you doing so much work to achieve something very simple? what you need to do is dynamically create a grid layout then put other views in it
This is a very open-ended question. It's also not simple.
You're going to have to do a lot of low-level coding to achieve what you outlined. No matter the case, you're going to have to find a way to turn that SVG into something that can be interacted with. The limiting factor here is that you're using SVGs--that's not a data format, it's vector. Unless you parse SVG into something more usable for a UI, or can get this data in a different format (some form of parsed JSON?), you're just showing an image.
Now assuming you do find a way to get this data more accessibly, you could go down the path of a custom view and overriding the draw(). Then you could just draw out your rooms and positions where you want, add a TouchListener, add a drawing state machine, etc. Alternatively to the View.draw(), you could use an GLSurfaceView and draw with hardware language.

Would Like Multiple Checkboxes to Update World PNG Image Using Mogrify to FloodFill Countries With Color

I'm seeing in another forum if the best way to do this is with Javascript or Ajax but I'm wondering if there is an even easier simpler way. I'm trying to create a web service where users can check which countries they have visited from a list of 175 or so and a World map image would then instantly update with a filled color.
There are other similar services, but I'm envisioning mine to be both updating from checks in checkboxes and by clicking on the target country in the displayed image say with an imagemap. Additionally other solutions display all the visited countries in the same color. I would like different colors for different countries or at least for those countries that touch. Eventually I would like to include a feature that enables the choice of which colors to assign countries.
I found a Sourceforge project called pwmfccd. It's simply an open source image of the world and the coordinates on the PNG image for all the countries. You can use mogrify from ImageMagick and floodfill to fill the countries with color. I have done this successfully, locally with batch files.
My ISP has told me where mogrify is located, basically "/usr/bin/mogrify". I now have a horrendously complicated cgi script which if it worked is set to redraw the world map image with each checkbox. It's here. It also redraws the whole web page with each check. The web page starts here. Of course this is not at all efficient, and I think probably the real way to go is Ajax or Javascript, so that maybe just the image gets changed and redrawn, not the whole web page. Sorry I don't even know the difference between Javascript and Ajax and their relative merits at this point.
I suppose you could make just one part of the image update with each check or click on the image instead of even just the image redrawing, but I have never even heard of a hint at being able to do that for irregularly shaped image elements like countries. So I guess an Image map and sister checkbox entries tied to mogrify events redrawing the user's personal copy of the image with an image refresh would be the only way to go.
So how do you do this with something other than Javascript or Ajax or is that definitely the way to go and if so, how would you do it? Or can you after all cut up a web based image into irregular puzzle shaped piece which you can redraw individually at will.
Thanks in advance for reading and considering answering this post.
Well, it looks like maybe my hosting company only supports using PHP with ImageMagick. At least I know better what to try create. I'm completely new to PHP, but I guess that is alright

Categories