IronNoob

Please login or register.

Login with username, password and session length
Advanced search  

News:

Migrated to dedicated hosting. Post any weirdness you observe in the Lounge.

Pages: [1] 2 3

Author Topic: Can you read a png file with VB?  (Read 272 times)

0 Members and 1 Guest are viewing this topic.

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Can you read a png file with VB?
« on: March 19, 2013, 01:28:25 pm »

like can you read pixel 121,256 of an image with vb?
Logged
death to incredibar maker

jamjam195

  • RBX Spec Ops
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 9288
  • Why, hello there.
    • View Profile
    • Bobstudios
Re: Can you read a png file with VB?
« Reply #1 on: March 19, 2013, 02:43:23 pm »

I think so?

You can do it with text editors.
Logged
Why Hello There.

Alternative: Wopian
Bobstudios | WPM: 81 | World of Wopian

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #2 on: March 19, 2013, 02:50:43 pm »

I think so?

You can do it with text editors.
how. can you give me example of code or point me to youtube video
Logged
death to incredibar maker

jamjam195

  • RBX Spec Ops
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 9288
  • Why, hello there.
    • View Profile
    • Bobstudios
Re: Can you read a png file with VB?
« Reply #3 on: March 19, 2013, 02:55:53 pm »

Logged
Why Hello There.

Alternative: Wopian
Bobstudios | WPM: 81 | World of Wopian

hopperkk

  • Full Member
  • ***
  • Offline Offline
  • Posts: 234
    • View Profile
    • Vortaxia
Re: Can you read a png file with VB?
« Reply #4 on: March 21, 2013, 10:50:56 am »

There's a whole other thread on it, believe it or not ;p *sarcasm*

http://www.vbforums.com/showthread.php?509292-RESOLVED-.png-files-in-Visual-Basic
Logged

^^Go there if you love gaming^^
No KL, scam or anything — just a fun building/scripting (Lua) game! (:

~hopperkk~

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #5 on: March 21, 2013, 03:59:28 pm »

Logged
death to incredibar maker

mustyoshi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3099
  • I'm a pig, your argument is invalid.
    • View Profile
Re: Can you read a png file with VB?
« Reply #6 on: March 22, 2013, 05:46:35 am »

Why do you keep visual basic :(
Logged

Act of God, insurance companies don't cover it.
[/m

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #7 on: March 22, 2013, 05:48:42 am »

Why do you keep visual basic :(
okay point me to a lua png reader. even better.
Logged
death to incredibar maker

mustyoshi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3099
  • I'm a pig, your argument is invalid.
    • View Profile
Re: Can you read a png file with VB?
« Reply #8 on: March 22, 2013, 06:00:15 am »

Why do you keep visual basic :(
okay point me to a lua png reader. even better.
Well, what is a png anyways? It's just a bunch of bytes that happen to be in a well defined format.
What are you trying to do is a better question :P
Logged

Act of God, insurance companies don't cover it.
[/m

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #9 on: March 22, 2013, 06:14:18 am »

Why do you keep visual basic :(
okay point me to a lua png reader. even better.
Well, what is a png anyways? It's just a bunch of bytes that happen to be in a well defined format.
What are you trying to do is a better question :P
be able to turn a png file into a table with all the pixels and their R,G,B
Logged
death to incredibar maker

mustyoshi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3099
  • I'm a pig, your argument is invalid.
    • View Profile
Re: Can you read a png file with VB?
« Reply #10 on: March 22, 2013, 09:47:45 am »

Why do you keep visual basic :(
okay point me to a lua png reader. even better.
Well, what is a png anyways? It's just a bunch of bytes that happen to be in a well defined format.
What are you trying to do is a better question :P
be able to turn a png file into a table with all the pixels and their R,G,B
Are you trying to make an image to block thing?
I can just give you the one I wrote if that's what you want to do.
Logged

Act of God, insurance companies don't cover it.
[/m

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #11 on: March 22, 2013, 10:07:46 am »

Why do you keep visual basic :(
okay point me to a lua png reader. even better.
Well, what is a png anyways? It's just a bunch of bytes that happen to be in a well defined format.
What are you trying to do is a better question :P
be able to turn a png file into a table with all the pixels and their R,G,B
Are you trying to make an image to block thing?
I can just give you the one I wrote if that's what you want to do.
not exactly, but if i can use that to basically be able to print(pixel
  • [y].rgb) then thatd be great

Logged
death to incredibar maker

mustyoshi

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 3099
  • I'm a pig, your argument is invalid.
    • View Profile
Re: Can you read a png file with VB?
« Reply #12 on: March 22, 2013, 10:25:48 am »

Code: [Select]
Public Class BMP
    Dim oFile As System.IO.File
    Dim oWrite As System.IO.StreamWriter
    Dim oRead As System.IO.StreamReader
    Dim formated As String
    Dim Test As String



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SelFile.FileOk
        ImageName.Text = "Image: " + SelFile.FileName
        Dim Bitmap As New System.Drawing.Bitmap(SelFile.FileName)
        Me.bricknum.Text = (Bitmap.Size.Width * Bitmap.Size.Height).ToString()
        Picture.PictureBox1.ImageLocation = SelFile.FileName
        Picture.Show()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SelFile.ShowDialog()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Picture.Close()
        If SelFile.FileName = "" Then
            MsgBox("Error, no Image Selected", MsgBoxStyle.Critical, "Error:5224")
        Else
            oWrite = System.IO.File.CreateText("C:\Roblox_Image.txt")
            Dim Bitmap As New System.Drawing.Bitmap(SelFile.FileName)
            Dim cont As Integer = 0
            oWrite.WriteLine(Me.BrickMake.Text)
            Dim form As String = "2"
            If Me.Sizey.Text / 1 = Int(Me.Sizey.Text / 1) Then
                form = "0"
            Else
                form = "2"
            End If
            oWrite.WriteLine("Brick.Size = Vector3.new(" + Me.Sizex.Text + "," + Me.Sizey.Text + "," + Me.Sizez.Text + ")")
            oWrite.WriteLine("Brick.formFactor = " + form)
            oWrite.WriteLine("Tab = {")
            For x = 0 To Bitmap.Size.Width - 1  'Syntax errors? I haven't done VB in a while
                For y = 0 To Bitmap.Size.Height - 1
                    Dim Color As System.Drawing.Color = Bitmap.GetPixel(x, y)
                    Dim col = Color.ToString()
                    If cont = 0 Then
                        formated = col
                        cont = cont + 1
                    Else
                        cont = cont + 1
                        formated = formated + col
                        If cont = 5 Then
                            cont = 0
                            formated = Replace(formated, "Color [A=255,", "Color3.new(")
                            formated = Replace(formated, "R=", "")
                            formated = Replace(formated, "G=", "")
                            formated = Replace(formated, "B=", "")
                            formated = Replace(formated, "]", "),")
                            formated = formated.ToString()
                            oWrite.WriteLine(formated.ToCharArray(), ",")
                        End If
                    End If
                Next
            Next
            oWrite.WriteLine("}")
            oWrite.WriteLine("x=" + (Bitmap.Width).ToString())
            oWrite.WriteLine("z=" + (Bitmap.Height).ToString())
            oWrite.WriteLine(Me.TheScript.Text)
            Dim pixelcount As Long = Bitmap.Height * Bitmap.Width
            If Me.CB1.Checked = True Then
                oWrite.WriteLine(Me.DeLag.Text)
                pixelcount = pixelcount * 2
            End If
            oWrite.Close()
            Dim msg As String
            If pixelcount > 100000 Then
                msg = "Please I beg, dont do this"
            ElseIf pixelcount > 50000 Then
                msg = "This might crash your computer, or just take forever"
            ElseIf pixelcount > 30000 Then
                msg = "You will be waiting for a few minutes"
            ElseIf pixelcount > 20000 Then
                msg = "This is going to lag ALOT"
            ElseIf pixelcount > 10000 Then
                msg = "There will be QUITE a bit of lag when you run the script"
            ElseIf pixelcount > 1000 Then
                msg = "There will be a slight lag"
            ElseIf pixelcount > 100 Then
                msg = "There will be almost no lag"
            End If
            MsgBox(msg, MsgBoxStyle.Critical, "!!!WARNING!!!")

        End If

    End Sub

    Private Sub BrickMake_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrickMake.TextChanged

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form2.Show()
    End Sub

    Private Sub DeLag_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeLag.TextChanged

    End Sub

    Private Sub TheScript_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TheScript.TextChanged

    End Sub
End Class

« Last Edit: March 22, 2013, 10:35:10 am by mustyoshi »
Logged

Act of God, insurance companies don't cover it.
[/m

Archimaredes

  • Newbie
  • *
  • Offline Offline
  • Posts: 26
  • fags
    • View Profile
Re: Can you read a png file with VB?
« Reply #13 on: March 27, 2013, 12:58:17 pm »

I find this sort of job a lot easier with C++, with libpng and all.
Logged
nigs

HatHelper

  • RBX Spec Ops
  • Hero Member
  • *****
  • Online Online
  • Posts: 2715
    • View Profile
Re: Can you read a png file with VB?
« Reply #14 on: March 28, 2013, 12:33:56 pm »

I find this sort of job a lot easier with C++, with libpng and all.
not as easy as using a language u already know
Logged
death to incredibar maker
Pages: [1] 2 3
 

Page created in 0.173 seconds with 21 queries.