# Vector graphics picture won't save

**URL:** <https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831>\
**Category:** General\
**Created:** [March 13, 2023, 8:51pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831 "2023-03-13T20:51:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 8:51pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/1 "2023-03-13T20:51:36Z")

</div>

Hobbyist programmer here.

I can create a picture with vector graphics but can not figure out how to save it and re-open it that way. I tried the PICTURE.SAVE method but it doesn’t work for me. There’s no parameter, at least not documented, that I can find that allows for saving as a vector-graphics file. I did discover using:

MyPicture.Save(f, Picture.SaveAsDefaultVector)

Also tried

MyPicture.Save(f, Picture.SaveAsWindowsEMF)

But it doesn’t save. No error message but also, no file result.

Windows 10 Pro platform.

Any tips would be appreciated.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [March 13, 2023, 10:13pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/2 "2023-03-13T22:13:38Z")

</div>

Have you setup the f parameter before hand. For example using a SaveFileDialog?

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:19pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/3 "2023-03-13T22:19:02Z")

</div>

Yep.

f = gAppFolder.Child(“A.PuzzlePicts”).Child(SaveName)

I also tried using the dialog methods. No luck.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [March 13, 2023, 10:22pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/4 "2023-03-13T22:22:31Z")

</div>

I’m assuming the gAppFolder is correctly initialised and “A.PuzzlePicts” folder exists. Do you get any error messages at all.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:26pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/5 "2023-03-13T22:26:50Z")

</div>

No error messages. I stepped through process, it appears to save, but there’s no result. When it went to save the file with the .Saveasdefaultvector extension I noticed it the File Exists property flipped to False.

But no error messages.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:27pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/6 "2023-03-13T22:27:19Z")

</div>

I was/am able to save this same file in the same location if I just save it as a BMP or TIFF file.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [March 13, 2023, 10:41pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/7 "2023-03-13T22:41:39Z")

</div>

Did you draw in a vector way? Take the example here:

[https://documentation.xojo.com/topics/graphics/drawing\_with\_vector\_graphics.html#topics-graphics-drawing-with-vector-graphics-saving-and-loading-vector-graphics](https://documentation.xojo.com/topics/graphics/drawing_with_vector_graphics.html#topics-graphics-drawing-with-vector-graphics-saving-and-loading-vector-graphics)

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:53pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/8 "2023-03-13T22:53:38Z")

</div>

I think I did. The entire graphics/picture realm is a hard world for me to crack. But that said, I took the picture from a fully functional, vectored drawing on another window. I need the vectors because I don’t want pixellated text. Works beautifully in the other window. Prints to a beautiful PDF file. But when I copy this graphic and try to save it … it won’t happen.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:54pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/9 "2023-03-13T22:54:03Z")

</div>

And I have scoured the documentation including the part you posted.

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [March 13, 2023, 10:55pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/10 "2023-03-13T22:55:41Z")

</div>

Have you tried copying the example in the documentation and seeing if that works with your saving code. Then you will know if it is your drawing code or something with the saving code.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 10:58pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/11 "2023-03-13T22:58:01Z")

</div>

No, haven’t tried that. I will.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 13, 2023, 11:05pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/12 "2023-03-13T23:05:41Z")

</div>

So here’s the code you suggested with a stringshape added. I scaled it to 2.0 to see if the text pixelates or not. It doesn’t. Looks great on the canvas. But … how do I save it? This is my sticking point.

Var SavePicture as new Picture(200, 200)  
Var r As New RoundRectShape  
r.Width = 120  
r.Height = 120  
r.Border = 100  
r.BorderColor = Color.RGB(0, 0, 0) // black  
r.FillColor = Color.RGB(255, 102, 102)  
r.CornerHeight = 15  
r.CornerWidth = 15  
r.BorderWidth = 2.5

Var ss as new StringShape  
ss.Text = “Hello”

SavePicture.Graphics.DrawObject(r, 100, 100)

g.DrawPicture(SavePicture, 0, 0) // Draw SavePicture in the Canvas  
g.ScaleX = 2.0  
g.ScaleY = 2.0  
g.DrawText (ss.text, 50, 50)

---

<div class="post-metadata">

**Author:** ![Ian\_Kennedy](https://forum.xojo.com/user_avatar/forum.xojo.com/ian_kennedy/32/6860_2.png) [@Ian\_Kennedy](https://forum.xojo.com/u/Ian_Kennedy)\
**Post date:** [March 13, 2023, 11:11pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/13 "2023-03-13T23:11:43Z")

</div>

It’s on the same page:

```auto
Var file As FolderItem
If TargetMacOS Then
  file = FolderItem.ShowSaveFileDialog("", "vector.pict")
Else
 file = FolderItem.ShowSaveFileDialog("", "vector.emf")
End If

If file <> Nil Then
  SavePicture.Save(file, Picture.SaveAsDefaultVector)
End If

```

When pasting code you should highlighting it and pressing the \</\> button, or type ``` before and after it.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 14, 2023, 2:38am UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/14 "2023-03-14T02:38:33Z")

</div>

Well, I tried that many times. Exact code. And still get no file. So could there be a bug in Xojo? I’ve uncovered two of them in my time here.

And yes, I should’ve highlighted the code. My mistake.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [March 14, 2023, 3:42am UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/15 "2023-03-14T03:42:29Z")

</div>

> [@Mark\_Jordan](#):
>
> Var SavePicture as new Picture(200, 200)

You need to make it a zero-depth picture:

Var SavePicture as new Picture(200, 200, 0)

New Picture(200, 200) creates a raster image with depth 32 and transparancy.  
New Picture(200, 200, 0) creates a vector image.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 14, 2023, 4:06am UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/16 "2023-03-14T04:06:38Z")

</div>

Hey, that’s good to know. I’ll try it.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 14, 2023, 2:18pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/17 "2023-03-14T14:18:05Z")

</div>

When I do that – new Picture(340, 280, 0) I get a Nil graphics on that picture.

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 14, 2023, 2:28pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/18 "2023-03-14T14:28:26Z")

</div>

![Debugger2](https://forum.xojo.com/uploads/default/original/2X/b/ba58b04569ad42fb9432b073bddab810064a1f19.jpeg)

![Debugger](https://forum.xojo.com/uploads/default/original/2X/1/1e687657a7aebcb11eb94fc86485b3a9d88d4b98.jpeg)

---

<div class="post-metadata">

**Author:** ![Mark\_Jordan](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c6cbf5/32.png) [@Mark\_Jordan](https://forum.xojo.com/u/Mark_Jordan)\
**Post date:** [March 14, 2023, 2:36pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/19 "2023-03-14T14:36:36Z")

</div>

I found something in a former thread that talks about shutting off ‘Supports HiDPI’. In the docs I found that you can only do this through “Shared Build Settings” but I don’t know how to do that.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [March 14, 2023, 2:40pm UTC](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831/20 "2023-03-14T14:40:12Z")

</div>

> [@Mark\_Jordan](#):
>
> ![Debugger2](https://forum.xojo.com/uploads/default/original/2X/b/ba58b04569ad42fb9432b073bddab810064a1f19.jpeg)

That’s correct, at that point p is Nil. You need to draw something so p will not be nil after that.

[Next page](https://forum.xojo.com/t/vector-graphics-picture-wont-save/74831.md?page=2)
