Editable Image Region

Editable Image Region - Messages

#1 Posted: 5/3/2014 6:47:12 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

In the SVN you find a plugin providing an editable image region (coded by Kay).

This is compatible with uni's image region. You can replace this in the image region plugin directory (for test only,

features:
- Double click launches the systems standard program for png- or svg-files. You may set that to your favorite editor, e.g. Windows Paint or inkscape.
- Context menu provides options to Import or Export images (no permanent link to the file name)
- Image is stored inside the sm-file, much like in the Picture Region
- Image is scaled to fit the region size while keeping aspect ratio (reset option to original size available in the context menu)
- Image file name (png or svg) can be specified in the image placeholder (invisible by default). Then
- if the file exists, region display is updated from file when recalculating
- if file does not exist, it is created based on current region contents
- Edit actions are performed using the specified file name
- Draw2D or Draw3D functions can directly be placed in the placeholder, thus you can hide the graphics commands completely by not displaying the input.
- Matrix data can be displayed as in uni's original version.

Edit process (you can only edit if the placeholder is empty)
- On double click, a temporary file is created if no file name is specified
- This file is sent to the image editor (based on system file type preferences)
- When you are done editing, just save the file and close the editor
- The modified file is read in
- Image is updated as soon as you leave the region.

Compared to Picture region it lacks the ability to be created by drag and drop or by pasting images from clipboard. Also, editing is not "in place" but in an external program.

I shall include this region in a portable SMath+Maxima version which is due for release soon.

Just to be clear: Best would be to edit in place with a decent tool set, possibly vector based. What we provide is a far approximation to this level of comfort.
image.sm (89 KiB) downloaded 127 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 users liked this post
Вячеслав Мезенцев 5/3/2014 8:10:00 AM, Davide Carpi 5/3/2014 6:39:00 PM
#2 Posted: 5/3/2014 8:10:06 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Quote

It should be possible to merge Image region and ImageEdit region into an image region. Uni, could you do that? Would you otherwise mind us to mess around in your code?


You can merge both source code into an image region. I don't mind.
Russia ☭ forever, Viacheslav N. Mezentsev
#3 Posted: 5/15/2014 8:20:57 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Uni, could you please try the merged region? Just replace your dll by this one:

https://smath.info/svn/public/plugins/ImageEditRegion/bin/Debug/Image.dll

There is one difference which I am aware of: If the file referenced in the placeholder does not exist, your version just didn't show anything, while Kay's version asks the user if he wants to create a new image. This may be a matter of taste, we would not insist on having it that way.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Posted: 5/16/2014 6:59:28 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

I suggest to have the region border or the canvas border enabled by default (in the second case an option to enable/disable the border could be added in the context menu); this because if there's no placeholder, without image, you have a full-transparent region floating in the worksheet.


best regards,

Davide
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Posted: 5/16/2014 11:04:17 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Wrote

Uni, could you please try the merged region? Just replace your dll by this one:

https://smath.info/svn/public/plugins/ImageEditRegion/bin/Debug/Image.dll

There is one difference which I am aware of: If the file referenced in the placeholder does not exist, your version just didn't show anything, while Kay's version asks the user if he wants to create a new image. This may be a matter of taste, we would not insist on having it that way.


Feel free to extend the functionality of the plugin. There is a bit of my code. I would be glad if you add something. Also you can change the behavior of the plugin if necessary.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Davide Carpi 5/16/2014 12:38:00 PM
#6 Posted: 5/16/2014 2:03:14 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

I suggest to have the region border or the canvas border enabled by default (in the second case an option to enable/disable the border could be added in the context menu); this because if there's no placeholder, without image, you have a full-transparent region floating in the worksheet.


I'll ask Kay if he can activate the welcome message if there is no contents in the region in order to avoid the invisible region problem.
Also, for those who like the frames, perhaps a context menu option could be added.
One more option would be for setting png or svg as image format before creating it.

Btw, when working with images, the real fun comes when you want to make changes. Then you really feel the difference. Just double click, edit and save. No worries about where to store the image or to miss it when changing the file locations.

@uni: We perhaps shall upload the plugin separately to the gallery, in order not to interfere with your access rights. If you feel safe to do so, you can remove the original image region from the gallery (by just removing the folders?). Alternatively, you can just merge our changes with your plugin and upload it yourself. Or upload our svn version in place of yours, just to your taste.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Davide Carpi 5/16/2014 6:21:00 PM
#7 Posted: 5/16/2014 8:07:56 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

The attached file shows severe performance problems of the modified image region. SMath freezes upon scrolling. This does not happen with the original version by uni. I informed Kay about this. Therefore, it is still early for release in the online gallery.

You may need to switch on the math regions in order to produce the images. The page, however, is also part of the interactive book where the images should be included in the distribution (Contents> Graphics> Plotting with Maxima> Examples for drawdf)
Examples maxima drawdf.sm (61 KiB) downloaded 88 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#8 Posted: 9/23/2014 4:26:15 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

I switched the plots in the previous post to png, which results in much faster loading.
Examples maxima drawdf.sm (684 KiB) downloaded 92 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 users liked this post
Davide Carpi 9/23/2014 5:18:00 PM, IVR 9/24/2014 1:16:00 PM
#9 Posted: 9/26/2014 11:09:06 AM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Hello,

I have a peculiar issue not being able to import svg files into the image region (it sticks to the empty .png after the import). I can copy image region with .svg from interactive workbook and it behaves as intended. If, however, I replace (import) svg in the region by a different svg file it does not resize.

Also .sm file attached fails to plot to svg as it is intended.

What version of Smath should I use with this image region? Are there any other dependencies? I am using windows 7 x64 and portable smath with maxima 0.97 build 5346

Thanks!
svg.sm (23 KiB) downloaded 82 time(s).
#10 Posted: 9/26/2014 12:31:55 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Hello,

I have a peculiar issue not being able to import svg files into the image region (it sticks to the empty .png after the import). I can copy image region with .svg from interactive workbook and it behaves as intended. If, however, I replace (import) svg in the region by a different svg file it does not resize.

Also .sm file attached fails to plot to svg as it is intended.

What version of Smath should I use with this image region? Are there any other dependencies? I am using windows 7 x64 and portable smath with maxima 0.97 build 5346

Thanks!


It seems that you used an old sm file from the forum. Maxima and the image region until recently have undergone changes during the development. It is best to use the portable distribution with the graphics examples as included there ([?]> Graphics> Plotting with Maxima

Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#11 Posted: 9/26/2014 12:42:56 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Thank you Martin,

However my goal is to import and work with .svg drawings - and this seems to be broken in my case. Unless I am doing something wrong (right click, import .svg does not work for me). Do you think it is a bug, or is it just my installation?

I found a work around though (that has some limitations):

0. specify working derictory
1. insert image region
3. name it "***.svg" - it will ask you if you want to create ***.svg in your working directory - OK

Note: after image is named "***.svg" it cannot be opened by double clicking

4. Delete image name (remove "***.svg)
5. Double click it to edit

Bug: image does not resize to fit the borders

Something does not seem to work as intended - likely tied to my Smath Studio install or hardware?

#12 Posted: 9/26/2014 2:16:15 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote


Something does not seem to work as intended - likely tied to my Smath Studio install or hardware?


Please post the offending images and the sheet where you want to import them.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#13 Posted: 9/26/2014 4:57:08 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Here is the .sm workbook with all the steps I tried to correctly add .svg to image region. Svg files attached are referred to in the workbook.

Thanks!
test.zip (3 KiB) downloaded 71 time(s).
1 users liked this post
Martin Kraska 9/27/2014 4:33:00 AM
#14 Posted: 9/27/2014 4:27:54 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Here is the .sm workbook with all the steps I tried to correctly add .svg to image region. Svg files attached are referred to in the workbook.


I confirm that importing svg images does not work. This is a bug. I filed this in the BTS as SS-224.

I also confirm that the given svg images aren't resizable. This is due to the presence of the "width" and "height" tags in the svg image. If you remove these lines, then the image can be resized. Some svg producers have the option to create dynamic svg without these lines, among them is gnuplot with the terminal setting "svg dynamic".

I don't know if the svg renderer can be asked to ignore the setting. As a workaround, the lines could be commented out by the importer. I filed a corresponding request as SS-225

Thus, the current state for creating editable svg images is:
- link an existing (possibly blank) svg image by specifying it's name in the placeholder. Changes in the image file are reflected in the image region
- remove the name from the placeholder. Now the contents is saved in the .sm sheet and can be edited (double click)



Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#15 Posted: 1/14/2016 1:14:37 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Is image region development still active? After working with it for more than a year I have tried numerous ways of using it as a primary sketching tool in SMath. I use it for creating engineering calculation books.

Overall its great. There are two points that it can be improved on.

1. Use of file format that supports layers. PaintNET's .pdn does that and also has a light-weight native editor (PaintNET). Any other file format would be great as well - the idea here to be able to scribble on top of base layer and than to delete and modify your scribbles as necessary.

2. Implement a variable that allows for image rotation - quite often the graph or another directly linked image does not fit into the printable area unless it is rotated. Often it is too cumbersome to rotate original file by hand (if it is created dynamically).

What do you guys think?
#16 Posted: 1/14/2016 2:57:00 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Alex,

You have missed something about CAS [Computer Algebra System]
NONE ... NONE is a graphic package, NONE will do what you ask for.
Mathematica, Maple, Matlab, MathcadPTC, Smath, Sage math, Scilab ...
Whatever you see from Joe Blo is math done. The main Mathematica book
is 3" thick, they have many more specialized application books ... etc.
"Drawing" is a graphic package. A graphic package is essentially a data
base system with very few analytic maths [Bézier to fillet and shapes ...]
Graphic packages range from freeware to !don't drop dead!
$5000/year per working station "Catia" [Boeing, Airbus, Bombardier].

"LibreCad", "FreeCad" are $0.00, unlimited use: both read/save AutoCad,
they are just limited in LISP.

If your project can be made in matrix form, Smath will output a 4D plot.
The matrix is splined, meshed at will, then goes the plot in 4 directions.

No idea about the max size of the matrix, slow on my machine.

"Scilab" is well geared in image processing [Satellite images, Police, weather ...]

Cheers, be good ... Jean
#17 Posted: 1/14/2016 3:07:32 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

Alex,

You have missed something about CAS [Computer Algebra System]
NONE ... NONE is a graphic package, NONE will do what you ask for.



I do not think we understand each other here, Jean. What I ask for is already 95% implemented in SMath Studio by developers of image region plugin. Insert the region, double click, edit the .png in editor of your choice.

The extra that I ask is to support additional file format with layers (great for sketching over existing drawing). Additionally I was hoping you could rotate the image imbedded by image region by say, specifying the value in degrees.

I believe the only unreasonable portion of my request is that there might not be a developer who has time or willingness to make those changes. And I can most definitely understand that.

Image region is one of the 5 SMath plugins I found MOST useful over 2 years of me using SMath.
#18 Posted: 1/15/2016 7:18:24 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Is image region development still active? After working with it for more than a year I have tried numerous ways of using it as a primary sketching tool in SMath. I use it for creating engineering calculation books.

Overall its great. There are two points that it can be improved on.

1. Use of file format that supports layers. PaintNET's .pdn does that and also has a light-weight native editor (PaintNET). Any other file format would be great as well - the idea here to be able to scribble on top of base layer and than to delete and modify your scribbles as necessary.

2. Implement a variable that allows for image rotation - quite often the graph or another directly linked image does not fit into the printable area unless it is rotated. Often it is too cumbersome to rotate original file by hand (if it is created dynamically).

What do you guys think?



The capability of the image region to call an external editor for png was implemented in the course of the maxima plugin project at the University of Applied Sciences Brandenburg. Coding was done by Kay Graubmann, a student, who is no longer available. He was an exception in terms of commitment and skill. I did the spec, testing and doc but do not have any insight in the code and didn't write a single line of C#.

There is very little chance that I will learn C#, as I currently focus on CalculiX, a free and open source non-linear structural analysis software written in Fortran and C. See my examples page on Github. The link points to an example with a reference solution in smath cloud.

4 years ago I thought it was a good idea to support freshmen students with weak math skills by software tools like SMath Studio. I changed my mind in the meantime and now run my first mechanics course with complete ban of electronic assistance, just pencil and paper. I have seen too many students not even being able to apply the pythagorean theorem or dividing a fraction by a fraction.

I use the image region heavily to create sketches for exercises in engineering mechanics (I use paint to draw and use math regions for text labels).

The image region is already able to display svg images, however, you can't embed them in the document or call an external editor (IPE or Inkscape). This should not be too complicated to implement and might be a good start for someone with C# skills to take over fürther development. Everything is in the svn repository, so feel free to engage.

If there happens to be another smart student or sufficient money to pay an assistant, then I could resume development. If there was a chance to write plugins in Python, I might try this myself.

Best regards, Martin Kraska
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Davide Carpi 1/15/2016 2:25:00 PM
#19 Posted: 1/15/2016 12:17:45 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I do not think we understand each other here, Jean. What I ask for is already 95% implemented in SMath Studio by developers of image region plugin. Insert the region, double click, edit the .png in editor of your choice.

The extra that I ask is to support additional file format with layers (great for sketching over existing drawing). Additionally I was hoping you could rotate the image imbedded by image region by say, specifying the value in degrees.

I believe the only unreasonable portion of my request is that there might not be a developer who has time or willingness to make those changes. And I can most definitely understand that.


_______________________________

Yes Alex, we understand each other but not completely.

Zoomable drawings can only be *.svg. Other stuff is "Photo zoom" style.
Smath supporting *.svg is useless from the start whereas Smath is not a graphic package.
You could not add a line directly except by transiting via Paint for instance. The other crappy point is like this: If something has been created from a matrix, it will keep the matrix all over its uncorrupted life. EXAMPLE: my Mandebrot, Biomorph were created from Mathcad image matrix, exposed in the Mathcad picture operator, saved *.PNG ... they open in Smath as they were created. My logo [blue ellipse on black that you may have seen in some Smath work sheet], this logo is a Mathcad ordinary 2D then not a bitmap, rather a Microsoft Metafile. It was transited via WinGrab, saved *.PNG, it opens in Smath but crappy stuff.

I have the Mathcad program to rotate a photo or an *.bmp. That same photo/bmp, I can downsample by 2 [1/2 size] via a little program. I can zoom up to 2 via fft/ifft padding but Smath does have 3D fft/ifft. The available fft/ifft is the Fourier stuff I have attached recently [few more are still missing].

An RGB image, i.e: *.bmp is conventionally an augmented matrix of the 3 grayscale R, G, B. It's peanut to separate the R,G,B in three nested matrices then appliy Euler rotation on the matrix, but here you are stuck again because Smath does not have the capability of plotting matrices and does not create an image from matrix.

Two more points in context:
1. If you have a 2D Smath plot [2 vectors], easy to rotate clockwise/trig.
Mutiply the vector plot by the trig rotate function V*f(θ) not the other way around,
it follows universal algebraic rule element wise. Same thing with 3D Euler rotation

2. I could but can't demo a little 'svg'. That is done in Mathcad, it needs to implement
De Casteljau 3 lines algorithm. I can rotate it as well. Not possible in Smath because Smath is not a scalar CAS except for the Smath quick plot of an entire function.

The wish list CAS + CAD lasted 10 years in the Mathsoft Collaboratory. As it looks, PTC have some convenient way of plugging some of their ProEngineer stuff in their Mathcad. It may be the route to your wish list. Be careful, downloading PTC Mathcad it is the crookery of the century. EXPLAIN: when you download it comes with "Artemis", Artemis is not a virus, just a fishing hooke. Artemis is a little code that can chain several web links. The purpose is to connect the victim to a another kind of web spy netwoork. The PTC Artemis is a triple link: the frist one is the Mathcad stuff, the 2nd is a web link to Costa Rica server . From this server is fishes for any and all information coming in/out of your box, hours used, clients address, ID card info, bank ... may be not the brand of the toilet paper. The 3rd link is the "TimeStamp" 30 days free trial. Then you are f...d with Artemis that apparently can't be removed from PC. Would you want PTC contacting your client from the back door. Your client stuff is surely private until his busness is well established.

Jean

Jean
#20 Posted: 1/28/2016 12:10:21 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote


The image region is already able to display svg images, however, you can't embed them in the document or call an external editor (IPE or Inkscape). This should not be too complicated to implement and might be a good start for someone with C# skills to take over fürther development. Everything is in the svn repository, so feel free to engage.

Best regards, Martin Kraska



Hi Martin,

I was tinkering with the region to add the svg support (blank document that opens on double click).

Do you think a dialog box that lets you choose png or svg on region initialization is appropriate? Or do you prefer a different method for choosing between two?

SMath community, feel free to engage in discussion!

1 users liked this post
Martin Kraska 1/28/2016 2:36:00 PM
  • New Posts New Posts
  • No New Posts No New Posts